Overview
| Artifact ID: | ec9f011614d338c82a442ee370a1f9601f0eca49 |
|---|---|
| Ticket: | 1737021fffffffffffffffffffffffffffffffff
unacceptable performance gap for switch |
| User & Date: | dkf on 2007-06-14 21:10:52 |
Changes
- icomment:
Logged In: YES user_id=79902 Originator: NO I *think* the thread-cache can hold 30 elements, and so if one of the REs in your example is spilled to a variable (or a literal), it turns out that all the RE compilations become cached (either in Tcl_Obj value caches or in the thread-cache) and that makes things much faster. I'm not keen on tweaking the size of the thread-cache, since it is a cost paid for by everyone; you can get better performance by doing something like this: # _Once_ only... foreach {k v} [array get global] { set re($k) ^$v } # In the loop global re switch -regexp -- $x $re(v00) - $re(v01) - $re(v02) - $re(v03) - ... { .... } If you use *that*, you'll find that things go faster (since the re array will manage the caches for you). - login: "dkf"
- mimetype: "text/plain"
- username: "dkf"