lua-users home
lua-l archive

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



My intention wasn't to make direct Lua/C speed comparisons. It was to show that Lua can be used in places where -at least I- thought it couldn't. The point is, that the whole application side was made with Lua. The next phase would be making colorful FFT-displays (those bouncing bars) also in pure Lua. I'll leave that as an exercise. :)

-ak

For those interested, the Lua code is attached.
The original is here: http://jcatki.no-ip.org/SDL_mixer/SDL_mixer_demos.zip


4.4.2005 kello 16:18, Adam D. Moss kirjoitti:

 Asko Kauppi wrote:
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


Attachment: sdlwav.lua
Description: Binary data