On Wed, Jun 23, 2004 at 09:08:43PM -0400, Leif K-Brooks wrote:
For my web-based application, I need to make twelve different calls to
str.replace for the content of /every/ page on /every/ page view (or
find a harder to implement and probably less elegant solution). Would
that be a major performance hit?
$ timeit -s 's = open("/usr/share/dict/words").read()' 's.replace("the", "xyzzy")'
100 loops, best of 3: 8.31e+03 usec per loop
/usr/share/dict/words contains 45k words in 410k bytes, with "the"
appearing on 409 of those lines. When I take the first 50000 bytes of
the file, I get a timing of 360 usec per loop.
Is 100 msec much per page view? Is 4 msec? What's the size of an
average page? I can't answer any of these questions for you.
Jeff
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (GNU/Linux)
iD8DBQFA2zosJd01MZaTXX0RAkTQAJwK7cBErVWrJU7zBg1tAW Q6+YDjJgCgqGA6
Ih+9xKTuAUJrFoXHA1hGdes=
=6CMv
-----END PGP SIGNATURE-----