lua-users home
lua-l archive

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



Here's the inofficial results of a small (20+ lines) test, run on three candidates.

Some observations:
     - Perl is about 2x faster than Lua
- C is about 8x faster than Perl (NOT using regex, but csv in C wouldn't need either..) - Perl performance is _not_ dependent on the way one describes the regex (= it seems to automatically cache them, anyways!)

System:   PowerBook G4 1,6GHz  OS X

The exact times, especially 'real' are not that important. The magnitudes are.


# Perl (qr//): 28s (31.37 real 26.58 user 1.19 sys) # Perl (//o): 28s (43.45 real 26.70 user 1.58 sys) # Perl (//): 28s (30.32 real 26.50 user 1.17 sys)

# Lua (match): 50s (70.44 real 48.70 user 1.71 sys) # Lua (gmatch): 1min 17s (88.00 real 75.11 user 1.62 sys)

# C (gets, strchr, -O3): 4s (4.48 real 3.33 user 0.74 sys)

For comparison, running "wc -l" on the file to get the disk overhead:

# wc (raw read):  2.7s  (30.96 real 1.49 user 1.22 sys)

-asko



On Fri, 10 Nov 2006 15:29:32 +1100
 "David Burgess" <dburgess@gmail.com> wrote:
How does gmatch compare?

db