Re: Converting strings to enum values (C API)
[
Date Prev][
Date Next][
Thread Prev][
Thread Next]
[
Date Index]
[
Thread Index]
- Subject: Re: Converting strings to enum values (C API)
- From: Philipp Janda <siffiejoe@...>
- Date: 2013年12月09日 18:23:28 +0100
Am 09.12.2013 17:26 schröbte Marc Lepage:
[...]
That seems to work well enough. Mapping tables stored in the registry.
Would it be beneficial to use upvalues instead? (Pros/cons? Performance?) I
haven't really done upvalues from C, I will check the docs.
Any suggestions/improvements?
luaL_checkoption 1.47 seconds
bsearch + memcmp 1.24 seconds
bsearch + strcmp 1.27 seconds
upvalue table 0.95 seconds
registry table 1.28 seconds
I only did string->enum, not the other way around. It seems that the
extra `rawget()` makes a huge difference (at least for the no-op test
functions), which probably also means that all those approaches should
be fine for real functions doing non-trivial work ...
Marc
Philipp