lua-users home
lua-l archive

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


Thomas Lauer wrote:
What's faster: 's:find(...)' or 'string.find(s,...)'?

I did a few preliminary tests and they seem to indicate that the object
variant is 5 to 10% faster (it's definitely faster to type...). Has
anyone done a performance analysis about OO calls vs normal calls?
i did quite some experiments with it and the 'oo' string calls are indeed faster

concerning typing, this is true when applied to variables, but on inline strings it looks kind of weird, compare:

string.format("abc: %s",123)

with

("abc: %s"):something(123)

Hans


-----------------------------------------------------------------
                                         Hans Hagen | PRAGMA ADE
             Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
    tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com
                                            | www.pragma-pod.nl
-----------------------------------------------------------------