lua-users home
lua-l archive

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


>I'll run some tests with QBasic or VBD and see what comes out.

Here are the results. I had to use a 16-bit DOS Basic (Microsoft's VBD) as
I don't have a 32-bit Basic installed, so the results are probably skewed
(I don't know in what direction, but 16-bit computations are *probably*
faster - I don't know modern CPUs well enough to tell; on the other hand,
the Basic program ran in a limited memory space).
I was also forced to limit the string size to about 30 kB (could somebody
re-run the test using VB?).

Lua program:

 s = ""
 for i = 1,30000 do
   s = s .. "x"
 end

Basic program:

 s$ = ""
 FOR i = 1 TO 30000
   s$ = s$ + "x"
 NEXT


Running times on my Pentium II/350, in seconds:

 Lua (standalone interpreter): 7.75
 VBD (interpreted):            4.94
 VBD (compiled):               0.17

The first two results are more or less equivalent (it could boil down to
the 32-bit vs. 16-bit difference), but the third one sounds interesting.
Maybe there could be space for string concatenation optimization, after all.

  Enrico