While working with Alchemy to port a roguelike library to handle field of view calculations for a 2d tile game (The Doryen Library, port is called libtcod-alchemy) I noticed some drastic speed differences between using a ByteArray in pure AS and manipulating that same ByteArray inside Alchemy. Out of curiosity I wondered how Alchemy manipulations of large data structures would compare to a native AS Array or the new (and faster) Vector.
As it turns out, Alchemy wins hands down when the data is already in a ByteArray. If you need to transfer data from an array/vector into a ByteArray to hand off to Alchemy and then transfer it back, it is slower to use Alchemy. For this test I have a collection of 1,000,000 numbers and for each iteration of the test, I loop over the numbers and add one.
Alchemy ByteArray additions are about 6 times faster than Vector integer additions and 10 times faster than pure AS manipulations of a ByteArray (when using Array notation [] on a ByteArray to manipulate a Byte - using position, readInt() and writeInt() in AS is much slower).
Below is test program that proves it:
Friday, March 13, 2009
Sunday, February 1, 2009
Lua Alchemy Getting Sweeter in v02a
Thanks to Alexander Lua Alchemy now has sugar! What this means is you no longer need to make calls like the following in the Lua Alchemy code:
Instead you can make calls that look like native Lua code:
This includes chaining calls like a.b.c().d
Below is a preview of the release:
as3.call(myvar, "someCall", param1, param2)
Instead you can make calls that look like native Lua code:
myvar.someCall(param1, param2)
This includes chaining calls like a.b.c().d
Below is a preview of the release:
Subscribe to:
Posts (Atom)