Sebastian\’s Coding Blog

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.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
%d bloggers like this: