lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On 2/11/2009, at 5:06 AM, Mike Pall wrote:
Consider using os.clock().

When I read that I thought "what, clock is implemented and undocumented in Lua?", but no, there it is in the PiL and the LRM right in front of me, where it has been for several years.

Anyway, I wrote a test harness for the kdtree. It's at http://www.incremental.co.nz/projects/lua.html . Instructions for getting data are in the comments in kdtree-test.lua.

Like the heap, I managed to screw some of test results up (just in case there's any doubt, I've been waiting for LJ2 with as much anticipation as the rest of the list and am convinced it will make the world a better place. My test cases are just a little problematic. Hopefully that's not too much bad coding on my part, and of some help for improving LJ2).

Reading and querying are much better. Querying is particularly nice: a tree query returns a coroutine iterator, so tracking a mouse moving across a map and highlighting the road it's over allocates an awful lot of coroutines, so lighter coroutines are a real bonus!

     Read     Build     Query
lua  6.33616  115.959   4.29028
LJ1  5.34206   74.3395  1.25906
LJ2  4.18      77.04    1.01

Cheers,
Geoff