Bug #15121
closedAlways preg_* instead of ereg_* functions
0%
Description
preg_* is much faster than ereg_*, therefore it should be used everywhere.
(issue imported from #M1685)
Files
Updated by Sebastian Kurfuerst about 19 years ago
131 ereg functions in tslib
314 ereg functions in t3lib
Updated by Bernhard Kraft about 19 years ago
Attached as files a fix which replaces all ereg's and split's in t3lib_parsehtml (used by automaketemplate and TV) with preg calls.
The tar.gz is a testsuite so you can test the speedup of the different methods of the class and verify the behave the same. Some of the methods now only need 8-15 % of the previous time.
preg_t3lib_parsehtml.diff : Patch
t3lib_parsehtml__pregtestsuite.tar.gz : Test-Suite
Updated by Ingo Renner about 19 years ago
how about replacing them in the whole core?
Updated by Michael Stucki about 19 years ago
how about replacing them in the whole core?
Step by step...! :-)
Updated by Bernhard Kraft about 19 years ago
I have already done this for t3lib_tsparser.php and t3lb_div.php .... But I still need to write the test-suite for those libraries (of course based on the previous one) ...
I don't think you can use refactored code without proper unit-testing. And as Michael stated this should get done step by step. I think the best method is to convert one class at once as this is an affordable amount of time needed to get invested at one time.
If some seldomly used ereg's are still there in 4.0.0 it won't hurt ... But you are right: The major part of heavyly used eregs/splits should get replaced as soon as possible.
Updated by Michiel Roos about 19 years ago
Good point Michael,
I'll fix my extensions right away.
Michiel
Updated by Scott Carson about 19 years ago
On behalf of the newbies ... I'm convinced this a great patch but, how do I install it????
Thanks!
Updated by Sebastian Kurfuerst about 19 years ago
Hi Scott,
this patch is not for end-users yet. It will most likely be included in the next TYPO3 release. What benefits do you expect from using it?
Greets, Sebastian
Updated by Bernhard Kraft about 19 years ago
Hi Scott,
As Sebastian stated this is not for production use. But if you want to help with testing you can download the t3lib_parsehtml__pregtestsuite.tar.gz to your development server. Extract the tar.gz and change to contained subdir "t3lib_parsehtml__pregtestsuite/testing_parsehtml/"
There you find .php executables: test_ (i.e. test_getSubpart.php) which test the single methods of t3lib_parsehtml.
You can invoke/call them by typing their name preceded by ./ (you need that on most UNIXes):
./test_getSubpart.php
Then a test will run through.
You can change the testdata in the "data_parsehtml.php" file and by changing the three testX.html files.
If you want to test the new parshtml library directly with TYPO3 just copy over the file class.t3lib_parsehtml_new.php to your t3lib/ directory over the original class.t3lib_parsehtml.php file (DON'T FORGET TO BACKUP THE ORIGINAL BEFORE !)
Please tell us your overall experiences.
Updated by Bernhard Kraft almost 19 years ago
The suggested patch for t3lib_parsehtml is now in CVS and part of TYPO3 4.0.0 beta1
Updated by Sebastian Kurfuerst almost 19 years ago
I hope you don't mind when I close this issue. - Cleanup.
Greets, Sebastian