Development

Changeset 23487

You must first sign up to be able to contribute.

Changeset 23487

Show
Ignore:
Timestamp:
10/31/09 22:06:03 (5 years ago)
Author:
FabianLange
Message:

[routing_performance] only generating .yml and routing config files if they do not exist. Otherwise memory information might be incorrect due to php/opcode caching. (sfRoute instances are created in the sfRoutingConfigurationHandler, those instances might be reused on loading the config instead of recreating them)

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • tools/routing_performance/routing_performance.php

    r23486 r23487  
    3636} 
    3737 
    38 $t->diag('Creating routing yml with 1500+ routes'); 
    39 // %1$s will be replaced by 1..500 by the sprintf below 
    40 $template = ' 
     38if (!is_file('routing.yml')) 
     39
     40  $t->diag('Creating routing yml with 1500+ routes'); 
     41  // %1$s will be replaced by 1..500 by the sprintf below 
     42  $template = ' 
    4143moduleA%1$s: 
    4244  url: /symfony%1$s/:build/:file 
     
    5153'; 
    5254 
    53 $singleRoutes = ' 
     55  $singleRoutes = ' 
    5456star1: 
    5557  url: /star/* 
    5658  param: {module: star, action: all} 
    5759'; 
    58 $routingConfigYml = ''; 
    59 foreach(range(1, 500) as $num) 
     60  $routingConfigYml = ''; 
     61  foreach(range(1, 500) as $num) 
     62  { 
     63    $routingConfigYml .= sprintf($template, $num); 
     64  } 
     65  file_put_contents('routing.yml', $routingConfigYml.$singleRoutes); 
     66
     67 
     68if (!is_file($patch.'/routing.php')) 
    6069{ 
    61   $routingConfigYml .= sprintf($template, $num); 
     70  $t->diag(sprintf('%s Routing - Creating Config', $patch)); 
     71  $stats = new Stats(); 
     72  $routingConfigHandlerNew = new sfRoutingConfigHandlerNew(); 
     73  file_put_contents($patch.'/routing.php', $routingConfigHandlerNew->execute(array(realpath('routing.yml')))); 
     74  $stats->log($t); 
    6275} 
    63 file_put_contents('routing.yml', $routingConfigYml.$singleRoutes); 
    64  
    65 $t->diag(sprintf('%s Routing - Creating Config', $patch)); 
    66 $stats = new Stats(); 
    67 $routingConfigHandlerNew = new sfRoutingConfigHandlerNew(); 
    68 file_put_contents($patch.'/routing.php', $routingConfigHandlerNew->execute(array(realpath('routing.yml')))); 
    69 $stats->log($t); 
    7076 
    7177// real world test starts here