2014-09-23 18:49 GMT+02:00 Hugues Peccatte hugues.peccatte@gmail.com:
2014-09-23 16:23 GMT+02:00 Marc Delisle marc@infomarc.info:
Hugues Peccatte a écrit :
2014-09-22 21:08 GMT+02:00 Hugues Peccatte hugues.peccatte@gmail.com:
2014-09-22 18:44 GMT+02:00 Marc Delisle marc@infomarc.info:
Hugues, do you still have the branch where each commit was separate, before squashing? -- Marc Delisle (phpMyAdmin)
With "git reflog", I've been able to get it back: git checkout -b memory 972e038
What do you have in mind?
Hugues.
I did a simple test:
- run substr 100000 times
- run $obj->substr 100000 times (where $obj->substr simply calls substr)
The second one is 3 times longer than the first one. The simple fact to
use
an object is too long. I tried something else: overwrite the functions. It's better: 2 times longer that the first one, but still slower…
That means that importing your file would take ~24 seconds instead of
~12
seconds.
Should we think about defining "pmaSubstr", "pmaStrlen", etc functions
and
use it everywhere?
Do you mean using functions without objects?
-- Marc Delisle (phpMyAdmin)
That's it. Instead of using $pmaString->strlen or strlen, we could imagine to use pmaStrlen and this function would call strlen or mb_strlen if mb_* functions exist. Another way could be to overwrite strlen with mb_strlen, but we wouldn't be able to use the original strlen if needed. So I think that we should define new functions.
I'll try to do a mass replacement and check if the execution time is better.
Hugues.
I had a better execution time with functions instead of objects [1]. My server is configured to have a maximum execution time of 300 seconds/5 minutes. And I wasn't able to import all the Marc's SQL file. But now, I can import the whole file into 3.5 minutes. We're still far of the ~12 seconds, but this is better…
Two other ideas to improve it again: * Use runkit [2], but it would add a dependency, so I'm not really for this solution * In PHP ≥ 5.6, we'll be able to use this feature [3]
So maybe I'll try to look for the slower part and try to improve it… I'll also try to find the commit which slows the script, as suggested by Marc. But this could be hard, because the commits between the first one and the last one are not really stables…
If anyone has another idea… Thanks,
[1] https://github.com/Tithugues/phpmyadmin/tree/stringFunctions_master [2] http://php.net/manual/en/function.runkit-function-copy.php [3] http://php.net/manual/en/language.namespaces.importing.php
Hugues.