lua-users home
lua-l archive

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


On Wednesday 01 September 2004 03:45 pm, Alex Queiroz wrote:
> extensible and backwards and forward compatible. I've promptly suggested
> Lua to be used as a scene description language, for I've used it myself
> as a scene description language for a ray-tracer I've wrote.
> While I was evangelizing there I grew aware that someone will ask sooner or 
> later if Lua can handle gacefully large arrays of vertices.

We use Lua as a description language for parameterized polygonal deformable 
models, which we use in a face tracking application, among other things. The 
largest models that we have handled successfully so far contained about 80K 
vertices and 150K faces. If we store the information in a pure data 
description format, similar to

n1 = node(1)
n2 = node(2)
...
face(n1, n5, n1)
face(n6, n3, n2)

set_parameter(n6, AddVector(p, { -2, -3, 6})
...,

then the execution of that lua script to build up the model takes 
approximately 7 seconds on a Xeon @ 2.4 Ghz with our code and Lua 4.0. We 
found that the most time-consuming part of the execution was the conversion 
from text to floating point numbers, so we ended up designing a 
special-purpose compiler to store frequently used data in a binary format in 
the machine's native floating point representation. After doing that, the 
model build time went down to 1.2 seconds.

We have not measured memory consumption, but this was never a concern for us. 
On the disk, such files take up a total of approximately 25 MB.

We have not tested the code on Lua 5.0 (because it breaks backward 
compatibility with 4.0 so badly), so I cannot say how much it might have 
improved things over version 4.0. Based on what we do know from our project, 
however, I would have to say that speed-wise plain text lua scripts do not 
handle really large arrays of vertices all that gracefully. Byte-compiled 
scripts may fare better, but as far as I understand, they cannot be exchanged 
across different architectures (correct me if I am wrong). So, it would come 
down to the question whether the wait to compile a data file is acceptable.

- Christian