lua-users home
lua-l archive

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


Just guessing, but the time taken will not be in the execution
of your script but the VM creation and parsing of the Lua
script.
If you were to separate the thread/vm creation and the script
execution (so that the thread/vm gets created before you want to
use it), you should find the script execution to be pretty quick.

DB
+++++++++++++++++++++++++++++++++
>Lo there,
>
>I searched the internet for a small, fast embedible scripting/language 
>to integrate in with my carrier grade web application (millions of 
>users) to replace php (which is very slow).
>
>Not wanting to rewrite the entire interface in c/c++ I figured it would 
>be worth looking at other languages. I've evaluated (and rejected) the 
>likes of Java, Python, PHP, Perl, oCaml and finally came to rest on lua.
>
>In multi-threaded C tests with a single process connecting to a socket 
>and driving a ascii based command line I can get 400 TPS (transactions 
>per seconds) across a 100 MBS network.
>
>I wrappered in lua (pretty easy all things considered) directly into the 
>core code and wrote myself a multi-threaded c program to run anything up 
>to 300 threads each running a lua parser.
>
>I got 2 TPS
>
>I figured maybe I was being dim and optimised my code so that it ran 
>compiled byte-code and got 4 TPS.  I then figured it was a waste of time 
>  each iteration of the lua script loading the same shared library so I 
>linked it in staticly and only call the registration once for each 
>thread and got 6 TPS.
>
>On the plus side lua doesn't seem to thrash the machine (80 idle at 100 
>threads) but the performance is dire.
>
>Am I being dim or is lua really this so..
>
>I've attached my lua test script (test.lua) my C lua wrapper 
>(lua_mmcore.c) and my multi-threaded test program (luatest.c).Apols if 
>they are a little rough around the edges but this was a test bed not a 
>long-term maintainable code base.
>
>Thanks in advance for any advice..
>
>Regards
>Simon
>
>-- 
>If you want to know what god thinks of money, just look at the people he 
>gave
>it to.
>		-- Dorthy Parker
>-- 
>This email and any attachments hereto are strictly confidential and 
>intended solely for the addressee. It may contain information which is 
>covered by legal, professional or other privilege. If you are not the 
>indended addressee, you must not disclose, forward, copy or take any 
>action in reliance of this email or attachments. If you have received 
>this email in error, please notify us as soon as possible.