Re: MUCH FASTER int_to_bytes, bytes_to_int, and allocate_string
- Posted by Robert Craig <rds at RapidEuphoria.com> Sep 12, 2001
- 478 views
Aku writes: > These functions is Copyright (c) 2001 Ting (alias Aku). You > may use this functions freely (especially for win32 API > structures). > ppi = allocate(4) > > global function int_to_bytes2(object x) > poke4(ppi, x) > return peek({ppi,4}) > end function Thanks for the benchmark results. Essentially the same performance trick has been in database.e for more than a year now: mem = allocate(4) procedure put4(atom x) -- write 4 bytes to current database file -- x is 32-bits max poke4(mem, x) -- faster than doing divides etc. puts(current_db, peek({mem, 4})) end procedure I accept that you can copyright the specific routines and benchmarks that you just posted. I don't accept that you can restrict the use of this trick by myself or anyone else. I may eventually rewrite int_to_bytes() and similar routines using this method. Regards, Rob Craig Rapid Deployment Software http://www.RapidEuphoria.com