Improving parsing performance
Posted by randomz on June 17, 2007
Lists in Sofud are implemented as arrays internally. This is perfectly sensible, as we mostly need fast random access to the element. However, this also means that any modification operations take O(n) time.
Not so bad, as we don’t expect lists to change a lot. But in one situation, performance could be improved: During parsing. The parser should look ahead how many items are going to be in the list, then create an array of the right size, and then insert the elements into that.
Not that big of a change maybe, but it might require some parser restructuring. And the speed drawback of the current method shouldn’t be noticeable with normal sized Sofu files, so this isn’t going to be in alpha1, but probably in 1.0.