Message170763
Yes, however it has a startup cost that the function that returns re.search(short_regex, s) and the one with functool.partial don't have, because with these the compilation happens at the first call.
If we use one of these two, the startup time will be reduced a lot, and the runtime will be ~2x faster.
If we use re.compile(short_regex).search the startup time won't be reduced as much, but the runtime will be ~8x faster.
Given that here we are trying to reduce the startup time and not the runtime, I think using one of those two functions is better.
Another possible solution to improve the startup time is trying to optimize _optimize_unicode -- not sure how much can be done there though. |
|
Date |
User |
Action |
Args |
2012-09-19 20:09:50 | ezio.melotti | set | recipients:
+ ezio.melotti, loewis, barry, orsenthil, nadeem.vawda, r.david.murray, rosslagerwall, serhiy.storchaka |
2012-09-19 20:09:50 | ezio.melotti | set | messageid: <1348085390.37.0.616956670035.issue11454@psf.upfronthosting.co.za> |
2012-09-19 20:09:49 | ezio.melotti | link | issue11454 messages |
2012-09-19 20:09:49 | ezio.melotti | create | |
|