Ronan Collobert wrote: > I try to generate random files where this would happen, with no > success: I really can't find the "trigger" which makes the thing > (match or gmatch) slow. The problem is the string interning and the partial hash used for strings. Actually, you can easily come up with an example where Lua 5.1 would hit the same problem, since it uses a (different) partial hash, too. There are some postings on the Lua mailing list that show examples for the weaknesses of the various partial hashes. One solution for this problem would be partial string interning and delayed hashing (like Lua 5.2.1). I can think of a couple more options. Alas, this requires pretty extensive changes and lots of experimentation to come up with the best compromise. IMHO it's too late in the LuaJIT 2.0 release cycle to change that. But I'll have to tackle this problem in LuaJIT 2.1, anyway (since everything about the internal object layout is going to change). > I noticed someone posted a somewhat related problem previously: > //www.freelists.org/post/luajit/Luajit-string-split-much-much-slower-that-Lua-string-split I don't think this is the same problem. The relevant strings are rather short and fully hashed. --Mike