I eventually did it only the "userdata int array" way, as suggested
on the list, and the results are quite remarkable:
Lua:
fps=13.70
Native C:
fps=43.22
The application is an SDL mixer demo that plays a tune and
simultaneously shows its waveform on the screen. The 43->13 fps
change is hardly noticable to the eye, certainly much less than I
expected (the C code is tight, and the mixed sound data is passed as
2048 bytes per callback). Well done, Lua!! :)
Without knowing how much time is spent in the non-waveform-generating
code it's impossible to say how well Lua is doing here. I mean, sure,
Lua is a pretty good performer, but this test doesn't really say much
either way (it most definitely doesn't begin to imply, for example,
that the Lua code is about 1/4 as fast as its equivilent C code). :)
--Adam
--
Adam D. Moss - adam@gimp.org