timon.gehr at gmx.ch
Wed Feb 8 14:56:23 PST 2012
On 02/08/2012 11:46 PM, bearophile wrote:
> David Nadlinger:
>> Could it be that you are rebuilding the regex engine on every iteration
> This isn't the first time I see this problem.
> CPython caches the RE engines to avoid this problem, so after the first time you use it, it doesn't create the same engine again and again.
> Another solution is to change the API, and use a long and ugly function name like buildREengine() that makes it clear to the user that it's better to pull it out of loops :-)
The compiler should do loop invariant code motion for pure functions.
More information about the Digitalmars-d