the lazy hacker blog

How fast can you go ?

July 16th 2010

I started writing a database abstraction library in C++ (libdbic++) to see if I can write something simple and fast that I can use at work. I was surprised at how fast it did manage to go.

I also wrote ruby bindings (swift) with help from @shanehanna. This makes it easier to start writing apps in ruby and then switch to C++ if performance becomes a bigger priority. A single API that makes it easy to transition from ruby to C++ was the goal.

The performance numbers for retrieving 250,000 records of approximately 64 bytes each was quite encouraging. We intend to hack away at this until we have something nice and polished.

mysql
=====
                                     user     system      total        real
 ruby: do                        3.350000   0.110000   3.460000 (  4.431064)
 ruby: swift                     1.080000   0.110000   1.190000 (  1.905136)
 c: libmysqlclient               0.000000   0.000000   0.230000 (  0.933122)
 c++: libdbic++                  0.000000   0.010000   0.510000 (  1.163342)
 ruby: mysql2                    2.150000   0.040000   2.190000 (  3.155557)
 c++: libmysql++                 0.000000   0.000000   0.480000 (  1.437604)

postgresql
==========
                                     user     system      total        real
 ruby: do                        3.470000   0.130000   3.600000 (  4.583538)
 ruby: swift                     1.300000   0.070000   1.370000 (  2.010762)
 ruby: libpq                     1.800000   0.120000   1.920000 (  2.815204)
 c++: libdbic++                  0.000000   0.000000   0.560000 (  1.336096)
 c: libpq                        0.010000   0.000000   0.510000 (  1.085639)
blog comments powered by Disqus