Slow memory allocation

new topic     » topic index » view thread      » older message » newer message

Suprisingly my old Python code was faster than Euphoria. I was reading a file of
40.000 lines like this:
a10_Clo10_BL26_ClFish_O_C251A_0_0_0_2003X04	Clown Fish 17
mark	120	B	405	425	404.83	425.86	71.0	51.0	false	-1.0	-1.0	-1.0	-1.0	-1.0	-1.0	-1.0	-1.0	-1.0	1.0
into memory. The code is below. It took 2 minutes just reading the file into
memory during which the ntvdm.exe was running at full speed and memory allocation
rose slowly to around 55 megabytes. If I skipped the line: table =
append(table,line) this took 2 seconds.

include kparse.e

sequence line, table
integer file
object o_line
constant TRUE = 1
constant FALSE = 0
constant TAB = 9

file = open("big_file.txt", "r")
table = {}
	while TRUE do
	o_line = gets(file)
	if atom(o_line) then
		exit
	end if
	line = {}
	line = Kparse(o_line, TAB)
	table = append(table,line)
end while

new topic     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu