lua-users home
lua-l archive

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


On Jan 4, 2012, at 9:52 PM, Sam Roberts wrote:

>  write a small lua program that parses a 2 MB string of key/value pairs into a hash table and takes many hours to do so 

Sure thing.

Setup:

Generate two set of headers, one random, one not so. 

The resulting two files are about 67MB in size, about a million entries each.

Then process both content with a run-of-the-mill header parser.

local aTime = os.clock()

ReadHeader( io.open( 'notsorandom.txt', 'rb' ) )

print( os.clock() - aTime )

And the results are:

random:               24.88277
notsorandom: 902.190881

So quite taxing altogether. 


Attachment: TestHeader.lua
Description: Binary data