merged branch Toflar/patch-1 (PR #3408)
merged branch Toflar/patch-1 (PR #3408)

Commits
-------

4f8e8ef Improving performance on digit filtering

Discussion
----------

Improving performance on digit filtering

I haven't tested it on a productive system but I think it should be way faster to use filter_var() instead of preg_replace() for several reasons.

This is my first pull request for symfony and I don't know how you do those kind of performance tests but please verify my assumption if you can :-)

Maybe we can also use filter_var() to replace other regular expressions :-)

HTH =)

---------------------------------------------------------------------------

by drak at 2012-02-22T00:35:44Z

@Toflar - nice move +1

---------------------------------------------------------------------------

by drak at 2012-02-22T18:53:40Z

@Toflar - Maybe you can bench the changes using this as a template: https://gist.github.com/1356129

---------------------------------------------------------------------------

by Toflar at 2012-02-23T13:18:18Z

I have already. And it's way faster, otherwise I wouldn't have opened a pull request ;) But obviously it strongly depends on the length of the string and the environment. That's why I was wondering whether you have a general performance tests environment ;) Because the results strongly depend on other factors, there's - in my opinion - no point in exact results. If a general info is sufficient: my tests for the regex resulted in about 7 - 8 microseconds whereas the filter version only took 1.5 - 2 microseconds for the same string.

mneuhaus/HttpFoundation,ygerasimov/HttpFoundation,nichdu/HttpFoundation,symfony/HttpFoundation,symfony/http-foundation,oswaldderiemaecker/HttpFoundation