NEWBIE: ishexdigit revisited
Kirk Strauser
kirk at strauser.com
Tue Dec 30 17:05:05 EST 2003
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
At 2003-12-30T21:45:13Z, Paul Rubin <http://phr.cx@NOSPAM.invalid> writes:
> You're using an extreme example and seeing the cost of the cache lookup in
> the first example.
The OP may be coding in an extreme situation. Given the free performance
gain without requiring any more work, resources, or syntax, I can't think of
a good reason *not* to pre-compile any regexp used more than a few times.
> You're certainly not seeing the pattern get recompiled a million times in
> 5 seconds. Doing would be many times slower.
Regardless of the cause, there's still a 400% increase in overhead in my
example by not pre-compiling the pattern.
- --
Kirk Strauser
The Strauser Group
Open. Solutions. Simple.
http://www.strausergroup.com/
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.3 (GNU/Linux)
iD8DBQE/8fZB5sRg+Y0CpvERAnMHAKCcnpcvqnFwtoexLImr9RzkMe5AugCfeZf4
YsqhMvp9d2+XG8aQFphRJqA=
=WvXA
-----END PGP SIGNATURE-----
More information about the Python-list
mailing list