[FrameworkBundle] Improved TemplateNameParser performance#7812
Merged
fabpot merged 1 commit intosymfony:masterfrom Apr 23, 2013
Merged
[FrameworkBundle] Improved TemplateNameParser performance#7812fabpot merged 1 commit intosymfony:masterfrom
fabpot merged 1 commit intosymfony:masterfrom
Conversation
Contributor
There was a problem hiding this comment.
'/^([^:]*):([^:]*):(.+)\.([^\.]++)\.([^\.]++)$/' could be slightly faster
Contributor
Author
There was a problem hiding this comment.
I don't really notice a difference. Interesting feature though, didn't know about double plus! :)
fabpot
added a commit
that referenced
this pull request
Apr 23, 2013
This PR was merged into the master branch.
Discussion
----------
[FrameworkBundle] Improved TemplateNameParser performance
| Q | A
| ------------- | ---
| Bug fix? | no
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | -
| License | MIT
| Doc PR | -
Performance test in symfony-standard:
```php
<?php
use Symfony\Bundle\FrameworkBundle\Templating\TemplateNameParser;
require __DIR__.'/vendor/autoload.php';
require __DIR__.'/app/AppKernel.php';
$kernel = new AppKernel('dev', true);
$kernel->boot();
$parser = new TemplateNameParser($kernel);
$time = microtime(true);
for ($i = 0; $i < 50; ++$i) {
$parser->parse("AcmeDemoBundle:Foo:bar$i.html.twig");
}
echo "Time: " . (microtime(true) - $time)*1000 . "ms\n";
echo "Memory: " . memory_get_peak_usage(true)/(1024*1024) . "MB\n";
```
Before:
```
Time: 3.80706787109ms
Memory: 1.5MB
```
After:
```
Time: 3.13401222229ms
Memory: 1.5MB
```
Commits
-------
f092c7f [FrameworkBundle] Improved TemplateNameParser performance
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Performance test in symfony-standard:
Before:
After: