Re: Slow memory allocation

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

Except Kparses stops parsing and returns empty list.

So I wrote my own function and it parses my file in 3 seconds:
function mySplit(string s_input, sequence s_char)
	sequence l_return, s_return
	integer n_start, n_stop
	atom a_char
	
	if equal(s_char, "#") then
		a_char = '!'
	else
		a_char = '#'
	end if
	l_return = {}
	n_start = 1
	while TRUE do
		n_stop = match(s_char, s_input)
		if n_stop then
			s_input[n_stop] = a_char
			s_return = s_input[n_start..n_stop-1]
			l_return = append(l_return, s_return)
			n_start = n_stop+1
		else
			l_return = append(l_return, s_input[n_start..$])
			exit
		end if
	end while
	return l_return
end function

Tank you all for trying to help

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

Search



Quick Links

User menu

Not signed in.

Misc Menu