[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: [ANN] Lua 5.2.1 (work1) now available
- From: KHMan <keinhong@...>
- Date: Mon, 26 Mar 2012 02:41:07 +0800
On 3/26/2012 1:09 AM, Roberto Ierusalimschy wrote:
Intern on first compare is not easy to implement, there are a lot of
complications. A quick-and-dirty attempt at using long string hash
values to avoid extra memcmp() work didn't really work (a few %
slower than default lua-5.2.1wk1) because in the examples I am
using, there are a lot of equal compares (76%) which means memcmp()
is still mostly needed. Short string compares is still much faster.
A possible small optimization is to check whether "a == b" in
'luaS_eqlngstr', before doing the memcmp.
No improvement for this particular script. Since the script loads
from 2 separate data files, I think the longstr compares are
always a!=b. OTOH, there seems to be little penalty for the extra
test.
same files (timing in sec, lower of 2 runs)
=========================================
dataset -> md5 sha1 sha256
hex str len 32 40 64
--------------------------------------
lua-5.1.5 2.621 2.646 2.709
lua-5.2.0 2.356 2.379 2.447
lua-5.2.1wk1
shortlen=16 3.107 3.336 3.526
shortlen=32 2.547 2.976+ 3.223+
shortlen=48 2.355 2.361 3.042
shortlen=64 2.365 2.344 2.413
shortlen=128 2.382 2.376 2.429
try2* 2.551 3.006+ 3.190+
* try2 has (a==b) added in luaS_eqlngstr()
with default shortlen=32
+ times that compare effect of adding (a==b)
--
Cheers,
Kein-Hong Man (esq.)
Kuala Lumpur, Malaysia