1. Faster allocate_string()
This an improved version of allocate_string().
Performance improvement is small, on the order of 20%, but might be of interest
to some.
global function allocate_string(sequence s)
atom addr
addr=machine_func(M_ALLOC, length(s) + 1)
if addr then
poke(addr, s)
poke(addr + length(s), 0)
end if
return addr
end function
The use of machine_func(), rather than allocate(), saves a function call and the
type check used in allocate(). The type check is unnecessary here as the length
of a sequence is guaranteed to be a positive integer.
I fully recognize that the use of machine_func() is not normally justifiable in
an application, but a low level include file is another matter.
Larry Miller
2. Re: Faster allocate_string()
I see now that the change has been incorporated into Euphoria 2.5.
I have downloaded 2.5 but am still using 2.4 because the startup time of 2.5 is
excessive on my rather elderly machine.
Larry Miller