lua-users home
lua-l archive

Re: LuaJIT string concat

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On 4/13/11 3:46 PM, steve donovan wrote: [Well, I think by now we are all eager: where are the numbers?
I tested something like this -- not sure how accurate that is but it shows a tendency

lower Y means: faster

Lua 5.1 official
----------------------------------------------------------------------------o-
x=[1..100] elements in t[i] = 'abc' .. i
+: '[' .. table.concat(t) .. ']'
x: string.format('[%s]', table.concat(t))
----------------------------------------------------------------------------o-
nsec/element -=xXx=- '..' and string.format()
550 |:
530 |:x
510 |:
490 |:
470 |:
450 |:
430 |:
410 |:
390 |:
370 |:+x
350 |:
330 |:
310 |: x
290 |:
270 |: +
250 |: x
230 |: + x
210 |: x
190 |: + xx
170 |: ++ xx
150 |: ++ x
130 |: +++***xxxxx
110 |: +++++**********xx*xxxxxxxxxx xx
90 |: ++ ++++++++++**++*** +: [103..384] x: [107..548]
70 |:
50 |:
30 |:
10 |:
0 |:_________________________________________________
elements: ^1 ^20 ^40 ^60 ^80
x=1 +: 810; x: 1267


Lua 5.1 official - Luabench 0.3.0
----------------------------------------------------------------------------o-
x=[1..100] elements in t[i] = randstr 1 - 200 chars
+: '[' .. table.concat(t) .. ']'
x: string.format('[%s]', table.concat(t))
----------------------------------------------------------------------------o-
nsec/element -=xXx=- '..' and string.format()
660 |:
640 |:x
620 |:
600 |:
580 |:
560 |:
540 |:
520 |:+
500 |:
480 |: x
460 |:
440 |:
420 |: x
400 |: +
380 |:
360 |: x x xx x
340 |: x+ x x x x x x x
320 |: +xx xxxxx x xx x x x+ x xx xx x [295..652]
300 |: + +++ x xx +x+ + +xxxx x xx xx
280 |: ++x+ + ++++ + + + + ++ +++++++++++ [259..537]
260 |: + +++ +++ + ++
240 |: +
... |..................................................
elements: ^1 ^20 ^40 ^60 ^80
x=1 +: 1227.9; x: 1519.5


Henning


AltStyle によって変換されたページ (->オリジナル) /