Since the new C SDK will be the base for every server’s clients will write in the future (starting from the REALbasic plugin) I decided to invest some more time trying to optimize the C SDK.
I wasn’t satisfy by the old approach (the base algorithm hasn’t been touched in the latest years) so I decided to completely rewrite the way we download and interpret cursors from the server, trying to reduce as much as possible the reallocation of heap memory and the allocation of index buffers used to refers to the various field inside a cursor.
The old approach seemed fast enough for the average users but it performed very badly for very big cursors. I benchmarked the old way and thew new way using the same exact server, so the speedup you’ll see will be just referred to client side (the new server is already way faster than the old one).
I performed two queries, the first one select everything from a table with 50K rows and 6 columns, the second one select everything from a table with 400K rows and 10 columns (without any index because I just would like to test the raw client speed, I wasn’t interested in the server’s speed).
Here you go the results:
- Test 1: 50K rows and 6 columns
- old client speed: 0.59 secs
- new client speed: 0.51 secs
- speed up about 15%
- Test 2: 400K rows and 10 columns
- old client speed: 41 secs
- new client speed: 7.8 secs
- speed up about 525%
As you can see for very large queries the speedup is quite impressive and this is due just to the way memory is managed in the new SDK. I forgot to mention that since memory is now allocated in a more efficient way, even the memory required to perform large queries is greatly reduced.
About The Author: Marco
More posts by marco