VASmalltalk – JSON wrapper

The JSON wrapper for VASmalltalk has gone under heavy development again.

The original version stopped at version 0.30. This version has been written with a character based C-API using callbacks into Smalltal to build the object structure. For a JSON document with a size of around 330 KByte this version needed around 310ms to build a base object structure.

Yesterday I build a version 1.0, where the character-based parsing was transfered from the Smalltalk layer to the C-layer and converted into a String-based parsing. The improvements were pretty nice: to build the structure VA now needed around 131ms. This version still needed callbacks into Smalltalk to build the Object. Therefore the usage had a little limitation: it had to be run synchronous in the GUI thread. The improvements were mainly due to he fact, that the number of jumps from Smalltalk to C was dramatically reduced. One call for the string with the JSON source and and then the callbacks to Smalltalk. This version is available at vastgoodies.

Today I build the version 2.0, where I changed lot of code in the low-level C library and remove the callbacks-mechanism. Instead of this the c library builds a linked list of the nodes of the JSON document and Smalltalk parses them after the C library has done the whole work and build the object structure. The time went down to 95ms, the callbacks and instances of EsEntryPoints are gone and the system can now be called from background threads. This version still needs some more testing and will be available at vastgoodies the next days.

I had the chance to test an early port of the JSON Petit parser against this JSON wrapper. This early build was around 4 times slower than the 0.30 version of this wrapper.

This entry was posted in Smalltalk and tagged , . Bookmark the permalink.

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