Re: [fw-general] Zend_Loader_ClassMapAutoloader slow than old autoloader

2012-10-15 Thread Cristian Bichis

Thanks Artur,

I was testing this only on dev machine without opcode cache and I 
confirm all your conclusions:

- without opcode cache is slower than with normal autoloaders
- with opcode cache is faster than normal autoloaders
- it consumes more ram than normal autoloaders

Cristian

On Mon, Oct 15, 2012 at 1:03 PM, Cristian Bichis > wrote:


Anyone has an idea why the classmap autoloaders are so slow?


They will almost always be slower without opcode cache (like APC), but 
will be faster
that path-based loader with opcode cache. They are fastest with scale 
and complex
loading structures (i.e. many components with plugins, many modules 
scattered

across directories).

They will always consume more memory because the array of paths has 
to be loaded
and held there. With larger apps expect even 10-50 MB more mem usage. 
The upside
is faster code execution and static files should be served without php 
anyways.



--
  __
 /.)\   +48 695 600 936
 \(./ abod...@gmail.com 






Re: [fw-general] Re: autoloader example?

2012-10-15 Thread Tim
Thanks for the example Matthew, that pointed me further in the right
direction. I have this code which appears to run as I expect it to
run.



require_once '/lib/support/php/ZF2/Zend/Loader/AutoloaderFactory.php';

$paths = explode(PATH_SEPARATOR, get_include_path());
array_push($paths, '/lib/support/php');
array_push($paths, '/lib/support/php/ZF1');
set_include_path(implode(PATH_SEPARATOR, $paths));

$config = array(
'Zend\Loader\StandardAutoloader' => array(
'autoregister_zf' => true,
'namespaces' => array(
'Predis' => '/lib/support/php/Predis',
'Zend\\' => '/lib/support/php/ZF2/Zend',
),
'prefixes' => array(
'Zend_' => '/lib/support/php/ZF1/Zend'
),
'fallback_autoloader' => true
),
);
\Zend\Loader\AutoloaderFactory::factory($config);

$client1 = new \Zend_Http_Client;
$client2 = new \Zend\Http\Client;




And the objects and their types



Zend_Http_Client Object
(
[config:protected] => Array
(
...
)

Zend\Http\Client Object
(
[response:protected] =>
[request:protected] =>
...
)




You mentioned the importance of not using the include_path for the
dual stack usage, but I was having trouble getting it to work without
the configuration above.

Is this something I should be concerned about? Or am I fairly safe as
long as I'm explicit in using fully qualified namespaces and class
names?

Thanks,
Tim

On Mon, Oct 15, 2012 at 3:27 PM, Matthew Weier O'Phinney
 wrote:
> -- Tim  wrote
> (on Monday, 15 October 2012, 02:20 PM -0500):
>> Thanks for the reply, it helped me get the autoloader working.
>>
>> Follow-up question. I dont suppose it's possible to autoload ZF2
>> libraries, as well as ZF1 libraries in the same sentence is it?
>
> Yes it is, actually.
>
> You configure ZF2 via namespaces, and ZF1 via prefixes. You _must_,
> however, not use the include_path for this to work.
>
> So, as an example:
>
> Zend_Loader_AutoloaderFactory::factory(array(
> 'Zend_Loader_StandardAutoloader' => array(
> 'namespaces' => array(
> 'Zend\\' => 'path/to/zf2/library/Zend',
> ),
> 'prefixes' => array(
> 'Zend_' => 'path/to/zf1/library/Zend',
> ),
> ),
> ));
>
> Once you have, you can use components from each.
>
>> something like
>>
>> $var = new \Zend\Http\Client
>>
>> and
>>
>> $var2 = \Zend_Http_Client
>>
>> Where the first example would load the ZF2 library and the second
>> would load the ZF1 library
>>
>> Thoughts?
>>
>> On Mon, Oct 15, 2012 at 1:33 PM, whisher  wrote:
>> > http://robertbasic.com/blog/using-the-new-autoloaders-from-zend-framework-1-12
>> > 
>> >
>> >
>> >
>> > --
>> > View this message in context: 
>> > http://zend-framework-community.634137.n4.nabble.com/autoloader-example-tp4657613p4657617.html
>> > Sent from the Zend Framework mailing list archive at Nabble.com.
>> >
>> > --
>> > List: fw-general@lists.zend.com
>> > Info: http://framework.zend.com/archives
>> > Unsubscribe: fw-general-unsubscr...@lists.zend.com
>> >
>> >
>>
>> --
>> List: fw-general@lists.zend.com
>> Info: http://framework.zend.com/archives
>> Unsubscribe: fw-general-unsubscr...@lists.zend.com
>>
>>
>
> --
> Matthew Weier O'Phinney
> Project Lead| matt...@zend.com
> Zend Framework  | http://framework.zend.com/
> PGP key: http://framework.zend.com/zf-matthew-pgp-key.asc
>
> --
> List: fw-general@lists.zend.com
> Info: http://framework.zend.com/archives
> Unsubscribe: fw-general-unsubscr...@lists.zend.com
>
>

-- 
List: fw-general@lists.zend.com
Info: http://framework.zend.com/archives
Unsubscribe: fw-general-unsubscr...@lists.zend.com




[fw-general] Re: Replace Album tutorial route with title instead of ID

2012-10-15 Thread fwahlqvist
Hi Luke,,

Thank you for your great input, I have updated the changes below as you
mentioned, the url changes works fine but when I try to edit the form is
displaced but when I press "edit" I get rerouted to the add new module
instead. Looking closer at the code a noticed the the form post action have
changed to 


> 

i.e. the action have changed and droped the id, tryied to update code but no
luck, any ideas or suggestions?

Thank you




--
View this message in context: 
http://zend-framework-community.634137.n4.nabble.com/Replace-Album-tutorial-route-with-title-instead-of-ID-tp4657571p4657624.html
Sent from the Zend Framework mailing list archive at Nabble.com.

-- 
List: fw-general@lists.zend.com
Info: http://framework.zend.com/archives
Unsubscribe: fw-general-unsubscr...@lists.zend.com




Re: [fw-general] Re: autoloader example?

2012-10-15 Thread Matthew Weier O'Phinney
-- Tim  wrote
(on Monday, 15 October 2012, 02:20 PM -0500):
> Thanks for the reply, it helped me get the autoloader working.
> 
> Follow-up question. I dont suppose it's possible to autoload ZF2
> libraries, as well as ZF1 libraries in the same sentence is it?

Yes it is, actually.

You configure ZF2 via namespaces, and ZF1 via prefixes. You _must_,
however, not use the include_path for this to work.

So, as an example:

Zend_Loader_AutoloaderFactory::factory(array(
'Zend_Loader_StandardAutoloader' => array(
'namespaces' => array(
'Zend\\' => 'path/to/zf2/library/Zend',
),
'prefixes' => array(
'Zend_' => 'path/to/zf1/library/Zend',
),
),
));

Once you have, you can use components from each.

> something like
> 
> $var = new \Zend\Http\Client
> 
> and
> 
> $var2 = \Zend_Http_Client
> 
> Where the first example would load the ZF2 library and the second
> would load the ZF1 library
> 
> Thoughts?
> 
> On Mon, Oct 15, 2012 at 1:33 PM, whisher  wrote:
> > http://robertbasic.com/blog/using-the-new-autoloaders-from-zend-framework-1-12
> > 
> >
> >
> >
> > --
> > View this message in context: 
> > http://zend-framework-community.634137.n4.nabble.com/autoloader-example-tp4657613p4657617.html
> > Sent from the Zend Framework mailing list archive at Nabble.com.
> >
> > --
> > List: fw-general@lists.zend.com
> > Info: http://framework.zend.com/archives
> > Unsubscribe: fw-general-unsubscr...@lists.zend.com
> >
> >
> 
> -- 
> List: fw-general@lists.zend.com
> Info: http://framework.zend.com/archives
> Unsubscribe: fw-general-unsubscr...@lists.zend.com
> 
> 

-- 
Matthew Weier O'Phinney
Project Lead| matt...@zend.com
Zend Framework  | http://framework.zend.com/
PGP key: http://framework.zend.com/zf-matthew-pgp-key.asc

-- 
List: fw-general@lists.zend.com
Info: http://framework.zend.com/archives
Unsubscribe: fw-general-unsubscr...@lists.zend.com




Re: [fw-general] Re: autoloader example?

2012-10-15 Thread Tim
I think this is where I'm getting hung up.

Suppose I have 2 directories

(portion of /lib/support/php)

...
drwxr-xr-x 50 fsf fsf   4096 Oct  4 08:25 Zend
drwxr-xr-x 67 fsf fsf   4096 Oct 12 13:54 Zend1
...

"Zend" is ZF2
"Zend1" is ZF1

and I have set my include path to include that directory

$paths = explode(PATH_SEPARATOR, get_include_path());
array_push($paths, '/lib/support/php');
set_include_path(implode(PATH_SEPARATOR, $paths));

and I have the autoloader set to fallback to that directory with this
configuration


$config = array(
'Zend\Loader\StandardAutoloader' => array(
'autoregister_zf' => true,
'namespaces' => array(
'Something' => '/lib/support/php/Something',
),
'fallback_autoloader' => true
),
);
\Zend\Loader\AutoloaderFactory::factory($config);



Then when I try to use Zend1 libraries,

$client = new \Zend_Http_Client;
exit;


I get

PHP Fatal error:  Class 'Zend_Http_Client' not found

If I adjust the StandardLoader to include a different namespace, something like

'namespaces' => array(
'Something' => '/lib/support/php/Something',
'Zend1' => '/lib/support/php/Zend1'
),


Then, obviously, I get another class not found because nothing is
named Zend1 in those libraries

$var = new \Zend1_Http_Client;

PHP Warning:  require_once(Zend/Loader.php): failed to open stream: No
such file or directory in /lib/support/php/Zend1/Http/Client.php on
line 27
PHP Fatal error:  require_once(): Failed opening required
'Zend/Loader.php'
(include_path='.:/usr/share/php:/usr/share/pear:/lib/support/php') in
/lib/support/php/Zend1/Http/Client.php on line 27

And other combinations of the above continue to get me class not found errors.

Do I need to reverse myself here and rename the ZF2 libraries instead
and do some witchcraft with the "use" keyword?

Perhaps someone has an example?

Thanks,
Tim

On Mon, Oct 15, 2012 at 2:46 PM, luk  wrote:
> Tim Rupp wrote
>> Thanks for the reply, it helped me get the autoloader working.
>>
>> Follow-up question. I dont suppose it's possible to autoload ZF2
>> libraries, as well as ZF1 libraries in the same sentence is it?
>>
>> something like
>>
>> $var = new \Zend\Http\Client
>>
>> and
>>
>> $var2 = \Zend_Http_Client
>>
>> Where the first example would load the ZF2 library and the second
>> would load the ZF1 library
>>
>> Thoughts?
>
> You can still do that but you would need to register different namespace
> namess for ZF1 and ZF2, for ie Zend and Zend2.
>
>
>
> -
> Cheers,
> --
> Luke Mierzwa
> --
> View this message in context: 
> http://zend-framework-community.634137.n4.nabble.com/autoloader-example-tp4657613p4657620.html
> Sent from the Zend Framework mailing list archive at Nabble.com.
>
> --
> List: fw-general@lists.zend.com
> Info: http://framework.zend.com/archives
> Unsubscribe: fw-general-unsubscr...@lists.zend.com
>
>

-- 
List: fw-general@lists.zend.com
Info: http://framework.zend.com/archives
Unsubscribe: fw-general-unsubscr...@lists.zend.com




[fw-general] Re: Router not worked as expected

2012-10-15 Thread luk
mjapex wrote
> Actually I have nothing to do with route (no any coding), but the
> configurations.
> 
> For generated url, here is the code. 
> $this->url(array(
> 'controller'=>$this->controller, 
> 'action'=>$this->action,
> 'country'=>$this->country, 
> 'state'=>$this->state, 
> 'city'=>$city), 
> 'apts-city');
> 
> Following print out parameters came from url,
> http://localhost/rent/United+States/New+York/New+York/3
> 
> Array ( [controller] => rent [country] => United States [state] => New
> York [city] => New York [subcity] => 3 [action] => subcity [page] => 0 ) 

You can clearly see from your debug that your parameters are not being
matched correctly.Looks like your subcity param is being mixed with page.



-
Cheers,
--
Luke Mierzwa
--
View this message in context: 
http://zend-framework-community.634137.n4.nabble.com/Router-not-worked-as-expected-tp4657584p4657621.html
Sent from the Zend Framework mailing list archive at Nabble.com.

-- 
List: fw-general@lists.zend.com
Info: http://framework.zend.com/archives
Unsubscribe: fw-general-unsubscr...@lists.zend.com




[fw-general] Re: autoloader example?

2012-10-15 Thread luk
Tim Rupp wrote
> Thanks for the reply, it helped me get the autoloader working.
> 
> Follow-up question. I dont suppose it's possible to autoload ZF2
> libraries, as well as ZF1 libraries in the same sentence is it?
> 
> something like
> 
> $var = new \Zend\Http\Client
> 
> and
> 
> $var2 = \Zend_Http_Client
> 
> Where the first example would load the ZF2 library and the second
> would load the ZF1 library
> 
> Thoughts?

You can still do that but you would need to register different namespace
namess for ZF1 and ZF2, for ie Zend and Zend2.



-
Cheers,
--
Luke Mierzwa
--
View this message in context: 
http://zend-framework-community.634137.n4.nabble.com/autoloader-example-tp4657613p4657620.html
Sent from the Zend Framework mailing list archive at Nabble.com.

-- 
List: fw-general@lists.zend.com
Info: http://framework.zend.com/archives
Unsubscribe: fw-general-unsubscr...@lists.zend.com




Re: [fw-general] Zend_Loader_ClassMapAutoloader slow than old autoloader

2012-10-15 Thread Artur Bodera
On Mon, Oct 15, 2012 at 1:03 PM, Cristian Bichis  wrote:

> Anyone has an idea why the classmap autoloaders are so slow?


They will almost always be slower without opcode cache (like APC), but will
be faster
that path-based loader with opcode cache. They are fastest with scale and
complex
loading structures (i.e. many components with plugins, many modules
scattered
across directories).

They will always consume more memory because the array of paths has to be
loaded
and held there. With larger apps expect even 10-50 MB more mem usage. The
upside
is faster code execution and static files should be served without php
anyways.


-- 
  __
 /.)\   +48 695 600 936
 \(./   abod...@gmail.com


Re: [fw-general] Re: autoloader example?

2012-10-15 Thread Tim
Thanks for the reply, it helped me get the autoloader working.

Follow-up question. I dont suppose it's possible to autoload ZF2
libraries, as well as ZF1 libraries in the same sentence is it?

something like

$var = new \Zend\Http\Client

and

$var2 = \Zend_Http_Client

Where the first example would load the ZF2 library and the second
would load the ZF1 library

Thoughts?

On Mon, Oct 15, 2012 at 1:33 PM, whisher  wrote:
> http://robertbasic.com/blog/using-the-new-autoloaders-from-zend-framework-1-12
> 
>
>
>
> --
> View this message in context: 
> http://zend-framework-community.634137.n4.nabble.com/autoloader-example-tp4657613p4657617.html
> Sent from the Zend Framework mailing list archive at Nabble.com.
>
> --
> List: fw-general@lists.zend.com
> Info: http://framework.zend.com/archives
> Unsubscribe: fw-general-unsubscr...@lists.zend.com
>
>

-- 
List: fw-general@lists.zend.com
Info: http://framework.zend.com/archives
Unsubscribe: fw-general-unsubscr...@lists.zend.com




[fw-general] Re: autoloader example?

2012-10-15 Thread whisher
http://robertbasic.com/blog/using-the-new-autoloaders-from-zend-framework-1-12

  



--
View this message in context: 
http://zend-framework-community.634137.n4.nabble.com/autoloader-example-tp4657613p4657617.html
Sent from the Zend Framework mailing list archive at Nabble.com.

-- 
List: fw-general@lists.zend.com
Info: http://framework.zend.com/archives
Unsubscribe: fw-general-unsubscr...@lists.zend.com




Re: [fw-general] Handle comments

2012-10-15 Thread Matthew Weier O'Phinney
-- Ralf Eggert  wrote
(on Monday, 15 October 2012, 04:37 PM +0200):
> currently, I am writing a small module to handle comments for pages.
> This module will have a couple of view helpers to output any comments
> for the current page which is identified by the url. It has a service, a
> mapper and a TableGateway object to handle the data. No problem so far.
> 
> Now I wonder about the best practice to handle the comment saving.
> 
> - To check for a posted comment in the view helper sounds evil.
> 
> - An action controller still seems awkward since I would need to mess
>   around with forwarding and redirecting when error checking or
>   saving a comment.

That may be, but the point of a controller is to handle an incoming
request and map it to appropriate models and/or views. This, to me, is
an ideal fit.

> - A listener sounds better but still I need to add the triggering
>   somewhere in the process. But where?
> 
> - I could use the Module.php to check for a posted comment but that
>   does not sound good as well.
> 
> How would you handle this?

-- 
Matthew Weier O'Phinney
Project Lead| matt...@zend.com
Zend Framework  | http://framework.zend.com/
PGP key: http://framework.zend.com/zf-matthew-pgp-key.asc

-- 
List: fw-general@lists.zend.com
Info: http://framework.zend.com/archives
Unsubscribe: fw-general-unsubscr...@lists.zend.com




Re: [fw-general] Zend_Loader_ClassMapAutoloader slow than old autoloader

2012-10-15 Thread Cristian Bichis

Btw,

The command to strip out all require_once is not working correctly for 
1.12 with classmap:


http://framework.zend.com/manual/1.12/en/performance.classloading.html

1.
   % cd path/to/ZendFramework/library
2.
   % find . -name '*.php' -not -wholename '*/Loader/Autoloader.php' \
3.
  -not -wholename '*/Application.php' -print0 | \
4.
  xargs -0 sed --regexp-extended --in-place 's/(require_once)/\/\/
   \1/g'

There are some require_once still needed under Zend/Loader which are 
removed by this command. I don't have a patch but I had to remove some 
of the comments to make things work.


Cristian Bichis


[fw-general] Handle comments

2012-10-15 Thread Ralf Eggert
Hi,

currently, I am writing a small module to handle comments for pages.
This module will have a couple of view helpers to output any comments
for the current page which is identified by the url. It has a service, a
mapper and a TableGateway object to handle the data. No problem so far.

Now I wonder about the best practice to handle the comment saving.

- To check for a posted comment in the view helper sounds evil.

- An action controller still seems awkward since I would need to mess
  around with forwarding and redirecting when error checking or
  saving a comment.

- A listener sounds better but still I need to add the triggering
  somewhere in the process. But where?

- I could use the Module.php to check for a posted comment but that
  does not sound good as well.

How would you handle this?

Regards,

Ralf

-- 
List: fw-general@lists.zend.com
Info: http://framework.zend.com/archives
Unsubscribe: fw-general-unsubscr...@lists.zend.com




Re: [fw-general] Zend_Loader_ClassMapAutoloader slow than old autoloader

2012-10-15 Thread Matthew Weier O'Phinney
-- Cristian Bichis  wrote
(on Monday, 15 October 2012, 05:15 PM +0300):
> Thanks for your response.
> 
> I'll do more testing (including using an opcode cache, on my dev
> machine I don't use this only on staging and production).
> 
> I have one more question. There is any drawback that I have 3
> classmap files and not 1 or 2 ?

Shouldn't be an issue; in ZF2, I often have a half-dozen or more going.


> >No, and my own profiling has not shown this.
> >
> >Use a profiler (XHProf, XDebug, etc.) and check to see where the issues
> >are. If you are using an opcode cache, and it's primed, you should not
> >be seeing a slowdown.
> >
> >The one issue that might come into play is the size of your classmap
> >files. I _do_ recall that if a classmap file is overly large, you can
> >occasionally run into situations where parsing the classmap takes more
> >execution time and memory than simply loading the few files you need. As
> >such, it's always best to define the classmap for only the most commonly
> >used files, and not necessarily _everything_ in all the libraries
> >included in your application.
> >
> >Finally, if any files in the classmap are also making require_once
> >calls, you'll run into a situation where the classmap really doesn't
> >give you much benefit. If you're running the classmap generation tools
> >over ZF1, make sure you also comment out the require_once calls;
> >otherwise, the classmap will only benefit you for the first class
> >loaded, and none of its dependencies.

-- 
Matthew Weier O'Phinney
Project Lead| matt...@zend.com
Zend Framework  | http://framework.zend.com/
PGP key: http://framework.zend.com/zf-matthew-pgp-key.asc

-- 
List: fw-general@lists.zend.com
Info: http://framework.zend.com/archives
Unsubscribe: fw-general-unsubscr...@lists.zend.com




Re: [fw-general] Zend_Loader_ClassMapAutoloader slow than old autoloader

2012-10-15 Thread Cristian Bichis

Hi Matthew,

Thanks for your response.

I'll do more testing (including using an opcode cache, on my dev machine 
I don't use this only on staging and production).


I have one more question. There is any drawback that I have 3 classmap 
files and not 1 or 2 ?


Cristian Bichis

No, and my own profiling has not shown this.

Use a profiler (XHProf, XDebug, etc.) and check to see where the issues
are. If you are using an opcode cache, and it's primed, you should not
be seeing a slowdown.

The one issue that might come into play is the size of your classmap
files. I _do_ recall that if a classmap file is overly large, you can
occasionally run into situations where parsing the classmap takes more
execution time and memory than simply loading the few files you need. As
such, it's always best to define the classmap for only the most commonly
used files, and not necessarily _everything_ in all the libraries
included in your application.

Finally, if any files in the classmap are also making require_once
calls, you'll run into a situation where the classmap really doesn't
give you much benefit. If you're running the classmap generation tools
over ZF1, make sure you also comment out the require_once calls;
otherwise, the classmap will only benefit you for the first class
loaded, and none of its dependencies.




--
List: fw-general@lists.zend.com
Info: http://framework.zend.com/archives
Unsubscribe: fw-general-unsubscr...@lists.zend.com




[fw-general] Re: Extend Zend\Form\Form to output a div or article instead of input type text

2012-10-15 Thread samsonasik
You can create your custom FormRow, for ex :

namespace Application\View\Helper;

use Zend\Form\ElementInterface;
use Zend\Form\View\Helper\FormRow as BaseFormRow;

class FormRow extends BaseFormRow
   {
public function render(ElementInterface $element)
   {
$markup = parent::render($element);
return sprintf('%s', $markup);
   }
   }

and register it at module.config.php

'view_helpers' => array(
'invokables' => array(
'formrow' => 'Application\View\Helper\FormRow',
),
),



--
View this message in context: 
http://zend-framework-community.634137.n4.nabble.com/Extend-Zend-Form-Form-to-output-a-div-or-article-instead-of-input-type-text-tp4657572p4657593.html
Sent from the Zend Framework mailing list archive at Nabble.com.

-- 
List: fw-general@lists.zend.com
Info: http://framework.zend.com/archives
Unsubscribe: fw-general-unsubscr...@lists.zend.com




[fw-general] Re: ZF2 and understanding routes.

2012-10-15 Thread ryanrk
Yes,  that did it.  So we need to add an invokable for every controller?

Is there an easy way to make the routes default to a module so the module
name isn't in the URL?
Localhost/test instead of localhost/module/test

Thanks for your help,
Ryan



--
View this message in context: 
http://zend-framework-community.634137.n4.nabble.com/ZF2-and-understanding-routes-tp4657579p4657583.html
Sent from the Zend Framework mailing list archive at Nabble.com.

-- 
List: fw-general@lists.zend.com
Info: http://framework.zend.com/archives
Unsubscribe: fw-general-unsubscr...@lists.zend.com




Re: [fw-general] Zend_Loader_ClassMapAutoloader slow than old autoloader

2012-10-15 Thread Matthew Weier O'Phinney
-- Cristian Bichis  wrote
(on Monday, 15 October 2012, 02:03 PM +0300):
> I have a ZF 1.12 app I tried to optimize for speed. First thing was
> I removed the require_once calls. This has give me about 5-7%
> improvement on CPU and RAM.
> 
> I tried to optimize the loading side more, by using the new autoloaders:
> 
> The old app had the app config like this:
> 
> 'bootstrap' => array(
> 'path' => BASE_PATH .
> '/library/My/Application/Bootstrap.php',
> 'class' => 'My_Application_Bootstrap'
> ),
> 'autoloaderNamespaces' => array(
> 'my' => 'My_',
> 'application' => 'Application_',
> 'bvb' => 'Bvb_'
> ),
> 'appnamespace' => 'Application',
> 'pluginPaths' => array(
> 'My_Application_Resource' => 'My/Application/Resource/',
> 'Application_Application_Resource' =>
> 'Application/Application/Resource/',
> )
> 
> --
> 
> The new one has these changes:
> * I generated of course the autoload_classmap.php files in proper locations
> * I removed the pluginLoaderCache file
> *  index.php has this added:
> 
> require_once ZF_LIBRARY_PATH.'/Zend/Loader/AutoloaderFactory.php';
> require_once ZF_LIBRARY_PATH.'/Zend/Loader/ClassMapAutoloader.php';
> 
> Zend_Loader_AutoloaderFactory::factory(
> array(
> 'Zend_Loader_ClassMapAutoloader' => array(
> ZF_LIBRARY_PATH . '/autoload_classmap.php',
> BASE_PATH . '/library/autoload_classmap.php',
> APPLICATION_PATH.'/autoload_classmap.php'
> ),
> 'Zend_Loader_StandardAutoloader' => array(
> 'prefixes' => array(
> 'Zend' => ZF_LIBRARY_PATH . '/Zend',
> 
> 'Imagis' => BASE_PATH . '/library/My',
> 'Application' => BASE_PATH . '/library/Application',
> 'Bvb' => BASE_PATH . '/library/Bvb',
> ),
> 'fallback_autoloader' => true
> )
> )
> );
> 
> and on app config:
> 
> 'bootstrap' => array(
> 'path' => BASE_PATH .
> '/library/Imagis/Application/Bootstrap.php',
> 'class' => 'Imagis_Application_Bootstrap'
> ),
> 'appnamespace' => 'Application',
> 'pluginPaths' => array(
> 'My_Application_Resource' => 'My/Application/Resource/',
> 'Application_Application_Resource' =>
> 'Application/Application/Resource/',
> ),
> 
> 
> However, the weird thing I see is with the new config both the speed
> and memory usage is up with about 2 MB RAM (from 17 mb to 19 mb) and
> about 25% slower on load time (from 0.105 to about 0.133).
> 
> I haven't run an extensive benchmark on the app but since the new
> autoloaders should be more efficient I am very confused about the
> real benefits of the classmap autoloaders.
> 
> Anyone has an idea why the classmap autoloaders are so slow?

No, and my own profiling has not shown this.

Use a profiler (XHProf, XDebug, etc.) and check to see where the issues
are. If you are using an opcode cache, and it's primed, you should not
be seeing a slowdown.

The one issue that might come into play is the size of your classmap
files. I _do_ recall that if a classmap file is overly large, you can
occasionally run into situations where parsing the classmap takes more
execution time and memory than simply loading the few files you need. As
such, it's always best to define the classmap for only the most commonly
used files, and not necessarily _everything_ in all the libraries
included in your application.

Finally, if any files in the classmap are also making require_once
calls, you'll run into a situation where the classmap really doesn't
give you much benefit. If you're running the classmap generation tools
over ZF1, make sure you also comment out the require_once calls;
otherwise, the classmap will only benefit you for the first class
loaded, and none of its dependencies.

-- 
Matthew Weier O'Phinney
Project Lead| matt...@zend.com
Zend Framework  | http://framework.zend.com/
PGP key: http://framework.zend.com/zf-matthew-pgp-key.asc

-- 
List: fw-general@lists.zend.com
Info: http://framework.zend.com/archives
Unsubscribe: fw-general-unsubscr...@lists.zend.com




[fw-general] Zend_Loader_ClassMapAutoloader slow than old autoloader

2012-10-15 Thread Cristian Bichis

Hi,

I have a ZF 1.12 app I tried to optimize for speed. First thing was I 
removed the require_once calls. This has give me about 5-7% improvement 
on CPU and RAM.


I tried to optimize the loading side more, by using the new autoloaders:

The old app had the app config like this:

'bootstrap' => array(
'path' => BASE_PATH . 
'/library/My/Application/Bootstrap.php',

'class' => 'My_Application_Bootstrap'
),
'autoloaderNamespaces' => array(
'my' => 'My_',
'application' => 'Application_',
'bvb' => 'Bvb_'
),
'appnamespace' => 'Application',
'pluginPaths' => array(
'My_Application_Resource' => 'My/Application/Resource/',
'Application_Application_Resource' => 
'Application/Application/Resource/',

)

--

The new one has these changes:
* I generated of course the autoload_classmap.php files in proper locations
* I removed the pluginLoaderCache file
*  index.php has this added:

require_once ZF_LIBRARY_PATH.'/Zend/Loader/AutoloaderFactory.php';
require_once ZF_LIBRARY_PATH.'/Zend/Loader/ClassMapAutoloader.php';

Zend_Loader_AutoloaderFactory::factory(
array(
'Zend_Loader_ClassMapAutoloader' => array(
ZF_LIBRARY_PATH . '/autoload_classmap.php',
BASE_PATH . '/library/autoload_classmap.php',
APPLICATION_PATH.'/autoload_classmap.php'
),
'Zend_Loader_StandardAutoloader' => array(
'prefixes' => array(
'Zend' => ZF_LIBRARY_PATH . '/Zend',

'Imagis' => BASE_PATH . '/library/My',
'Application' => BASE_PATH . '/library/Application',
'Bvb' => BASE_PATH . '/library/Bvb',
),
'fallback_autoloader' => true
)
)
);

and on app config:

'bootstrap' => array(
'path' => BASE_PATH . 
'/library/Imagis/Application/Bootstrap.php',

'class' => 'Imagis_Application_Bootstrap'
),
'appnamespace' => 'Application',
'pluginPaths' => array(
'My_Application_Resource' => 'My/Application/Resource/',
'Application_Application_Resource' => 
'Application/Application/Resource/',

),


However, the weird thing I see is with the new config both the speed and 
memory usage is up with about 2 MB RAM (from 17 mb to 19 mb) and about 
25% slower on load time (from 0.105 to about 0.133).


I haven't run an extensive benchmark on the app but since the new 
autoloaders should be more efficient I am very confused about the real 
benefits of the classmap autoloaders.


Anyone has an idea why the classmap autoloaders are so slow?

Cristian



--
List: fw-general@lists.zend.com
Info: http://framework.zend.com/archives
Unsubscribe: fw-general-unsubscr...@lists.zend.com




[fw-general] Re: Zend Form, Fieldset attributes

2012-10-15 Thread miszyman
  The fieldset is used with a collection and its dynamically added from 
template so I cannot create it in such a way:/

W dniu 2012-10-15 10:35, luk [via Zend Framework Community] pisze:
>
> miszyman wrote
> mhm still didn't manage to do it.. any help? to be more specific I
> want to set the foo attr with boo value in the fieldset:
>
> 
> 
> label
> 
> 
>
> Zend\Form\Fieldset should not be used to create 
>  markup and I think it does not anyway.
> Use static html around your form elements in the view.
> 
> label
> formRow($form->get('somelement'))?>
> 
> Cheers, -- Luke Mierzwa
>
>
> 
> If you reply to this email, your message will be added to the 
> discussion below:
> http://zend-framework-community.634137.n4.nabble.com/Zend-Form-Fieldset-attributes-tp4657402p4657599.html
>  
>
> To unsubscribe from Zend Form, Fieldset attributes, click here 
> .
> NAML 
> 
>  
>


-- 
Pozdrawiam, Michał Szymański





--
View this message in context: 
http://zend-framework-community.634137.n4.nabble.com/Zend-Form-Fieldset-attributes-tp4657402p4657600.html
Sent from the Zend Framework mailing list archive at Nabble.com.

[fw-general] Re: Zend Form, Fieldset attributes

2012-10-15 Thread luk
miszyman wrote
> mhm still didn't manage to do it.. any help? to be more specific I want to
> set the foo attr with boo value in the fieldset:
> 
> 
> label
> 
> 

Zend\Form\Fieldset should not be used to create  markup
and I think it does not anyway.
Use static html around your form elements in the view.

label
formRow($form->get('somelement'))?>




-
Cheers,
--
Luke Mierzwa
--
View this message in context: 
http://zend-framework-community.634137.n4.nabble.com/Zend-Form-Fieldset-attributes-tp4657402p4657599.html
Sent from the Zend Framework mailing list archive at Nabble.com.

-- 
List: fw-general@lists.zend.com
Info: http://framework.zend.com/archives
Unsubscribe: fw-general-unsubscr...@lists.zend.com