1. Faster allocate_string()
- Posted by Larry Miller <larrymiller at sasktel.net> Jul 06, 2005
- 528 views
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()
- Posted by Larry Miller <larrymiller at sasktel.net> Jul 06, 2005
- 516 views
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