[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Ideas about implementing a string type?
- From: Mike Pall <mikelu-0703@...>
- Date: Thu, 29 Mar 2007 22:09:45 +0200
Hi,
for my taste there's a bit too much speculation about "typical"
application behaviour and the associated cost models in this
thread. The only way to find out is to measure the behaviour and
only then draw some conclusions.
It's pretty easy to count all occurences of string interning
(with [1] or without [2] copying), string comparison (equal [3]
or not [4]) and table lookups with string keys ([5]).
Here are the pertinent spots in the Lua core:
- Counters 1 and 2: lstring.c: luaS_newlstr
- Counters 3 and 4: add a new case LUA_TSTRING to
lvm.c: luaV_equalval and lobject.c: luaO_rawequalObj
- Counter 5: ltable.c: luaH_getstr, mainposition
In case the simple counters don't offer enough insights, one
could also log each event together with the string length and
generate some pretty graphs.
In a third step one could get some hard numbers on hashing and
copying overhead in the current implementation with CPU
performance counters (but be careful of outliers due to
preemption).
Sorry, I'm too lazy to make a patch and do the measurements.
But maybe David wants to do some profiling on his application?
I'm very interested in any results you may come up with.
[I smell the outline of a nice POPL paper here. Go for it.]
Bye,
Mike