Development

#4928 (CLI is still unacceptably slow)

You must first sign up to be able to contribute.

Ticket #4928 (closed defect: fixed)

Opened 8 months ago

Last modified 7 months ago

CLI is still unacceptably slow

Reported by: mahono Assigned to: fabien
Priority: major Milestone: 1.2.0 RC2
Component: tasks Version: 1.2.0 DEV
Keywords: cli task command cache Cc:
Qualification: Unreviewed

Description

I chose "defect" as it is really not possible to fluently work with the CLI.

I'm working on a Core 2 Duo @ 2.5 GHz and it takes a minimum of 5 seconds whatever command I want to execute using symfony 1.2 from subversion. These are 5 seconds too much. You can not seriously explain why it requires 5 seconds just to execute 5 simple lines of code.

I guess all tasks are loaded each time you want to execute one single command for the resolving of aliases and such stuff. So I suppose the task information of all available (& enabled) tasks has to be cached (name, namespace, aliases, etc.) to really speedup the execution.

Maybe something like "./symfony reload" or at best "./symfony cc" could be used to refresh the command cache!?

I (and probably others as well) would prefer such a caching and the need for refreshing it over the slow execution time.

Change History

11/24/08 14:51:50 changed by FabianLange

  • status changed from new to closed.
  • resolution set to fixed.
  • milestone changed from 1.3.0 to 1.2.0.

this has been adressed and for me on my machines cli is now significantly faster. fixed at least in RC1

11/24/08 15:41:13 changed by mahono

ok.. I will raise my hand again if I can manage to provide a useful patch. ;-)

11/26/08 18:05:38 changed by GaryFx

  • status changed from closed to reopened.
  • version set to 1.2.0 DEV.
  • resolution deleted.
  • summary changed from CLI is still unacceptable slow to CLI is still unacceptably slow.

The CLI is still unacceptably slow. I see this primarily with Doctrine, but I think there's an underlying problem as well.

I believe the Doctrine issue is because it doesn't do autoloading as efficiently as Propel. Propel appears to have a custom autoloader specified in its autoload.yml, while Doctrine just does a basic recursive search. The project_autoload.cache file I get for Propel is 18KB, while the one I get for Doctrine is 70KB, almost four times as big.

But the other, more subtle issue is that it appears the sfPluginConfiguration::initializeAutoload method recomputes the entire cache even when it exists. What's the point of the cache, then? [Aside: I just did a quick step through, and it appears initializeAutoload is being called twice, doubling the cost.]

This is on a vanilla SVN version, updated a few minutes ago, with two projects (for Propel and Doctrine, respectively), each with the appropriate default ProjectConfiguration? that calls enableAllPluginsExcept, with the appropriate ORM and sfCompat10Plugin excluded. It's on Windows Vista 64, which may have different performance characteristics from Linux when it comes to walking the plugin directory tree. I've done time ./symfony in both directories, and I'm getting just over 13 seconds for Doctrine, between 2.7 and 3.0 for Propel (AMD Turion 64x2, 1.8GHz, 2GB). I've repeated the command several times in a row, to check consistency and to get the benefit of OS caching. In my opinion, anything over a second for a vanilla ./symfony command is too long.

11/26/08 18:35:01 changed by FabianLange

i found the same, initautoload is called twice, i asked fabien about this already.. ill take some time tonight to debug this. got another xdebug dump of a slow cli command

11/26/08 21:28:26 changed by FabianLange

  • status changed from reopened to closed.
  • resolution set to fixed.

(In [13363]) [1.2] made command line much faster. fixes #4928

11/26/08 21:31:33 changed by FabianLange

  • milestone changed from 1.2.0 to 1.2.0 RC2.

i made a fix that will be in rc2 you need to take copy the new "symfony" file from data/bin into your project root to get the change

11/27/08 00:40:17 changed by GaryFx

This is certainly an improvement. My Doctrine times have gone to about 8.2-8.4 seconds, while the Propel times are now closer to 2.5. Still, I can't help but believe there's more room for improvement.

11/27/08 15:03:14 changed by rande

Hello,

I am not sure this is valid for sf1.2, but in sf1.1 classes are defined twice. I have to comment the first autoload declaration in the plugin.

autoload:
#  Doctrine:
#    name:       Doctrine classes
#    ext:        .php
#    path:       <?php echo realpath(dirname(__FILE__) . '/../lib') . "\n"; ?>
#    recursive:  on
  doctrine_model_classes:
    name:       Doctrine model classes
    ext:        .php
    path:       "%SF_LIB_DIR%/model/doctrine"
    recursive:  on

11/27/08 16:00:50 changed by FabianLange

r13392 should have fixed this

The Sensio Labs Network

Since 1998, Sensio Labs has been promoting the Open-Source software movement by providing quality web application development, training, consulting, and supporting several large Open-Source projects.