Message170763
| Author |
ezio.melotti |
| Recipients |
barry, ezio.melotti, loewis, nadeem.vawda, orsenthil, r.david.murray, rosslagerwall, serhiy.storchaka |
| Date |
2012年09月19日.20:09:49 |
| SpamBayes Score |
-1.0 |
| Marked as misclassified |
Yes |
| Message-id |
<1348085390.37.0.616956670035.issue11454@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
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. |
|