[sword-devel] Python bindings for libsword with SIP
troy.melhase at gmail.com
Sat Nov 28 04:36:16 MST 2009
> We have had the occasional bug in SWIG that has been worked around
> (particularly in SWIG's iteration over STL types, which has the
> unpleasant side effect of occasionally causing access violations).
> It's also worth considering the overhead of converting types like
> SWBuf to native Python types, since some of the buffers have lots of
> text in (not that I'm claiming SWIG is efficient).
I hadn't considered that the overhead would be large, so instead of
guessing, I wrote a little test script to time it. The best of 3 runs
$ python quick-test-speed.py SWIG
SWIG render time: 14.32
$ python quick-test-speed.py SIP
SIP render time: 15.90
The script is only loading the KJV module and calling RenderText() on
each verse, but at least for this case, the SWIG bindings are 10%
faster. Test script attached.
Also, I originally wrote the script to increment the module using the
+= operator; this gave me glibc errors at the end of each run using
the SWIG bindings. When I changed the script to use increment(),
those errors went away.
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 856 bytes
Desc: not available
More information about the sword-devel