On 2008-08-12, at 08:34EDT, André Bargull wrote:
The Profiler uses Arrays instead of Objects explicitly, not sure
what to do here, because all Arrays are sparse Arrays, so iterating
over them in a normal for-loop isn't a good idea.
That was a trick by me to keep the profiler logs as compact as
possible. There are two pieces of data that need to be logged each
time a function is entered/returned:
1) the function
2) the clock
If you use a sequentially-indexed array as the log, you would have to
allocate some other data structure for each entry to hold the 2
items. Using the clock as the array index is a trick (and leads to
trouble because of the way numbers are coerced to strings when used as
array keys).
Another approach could be to use two sequential arrays, one for each
data item. Perhaps that would be just as efficient, because most JS
engines seem to optimize arrays that have only sequential integer
indices.