Well, here are the first results. Boost.Python performs a lot slower than the raw approach.
The test suite just opens render window, loads an image, creates a sprite and renderes that sprite onto the render window with random positions.
Used Python version is 2.6, SFML version 1.6. The source code for both cases is identical except naming conventions.
Boost.Python
10 iterations took 0.0014 seconds.
100 iterations took 0.0013 seconds.
1000 iterations took 0.0114 seconds.
5000 iterations took 0.0588 seconds.
10000 iterations took 0.1132 seconds.
50000 iterations took 0.5619 seconds.
100000 iterations took 1.1588 seconds.
Raw Python C API
10 iterations took 0.0006 seconds.
100 iterations took 0.0010 seconds.
1000 iterations took 0.0066 seconds.
5000 iterations took 0.0337 seconds.
10000 iterations took 0.0634 seconds.
50000 iterations took 0.3118 seconds.
100000 iterations took 0.6288 seconds.
Conclusion
Nearly in all cases the raw approach performs 2 times faster than Boost. This is not acceptable in my opinion, since applications/games using (Py)SFML do need the speed.
Here's the source code which I've used for testing:
import sf
import time
import random
window = sf.RenderWindow( sf.VideoMode( 1024, 768, 32 ), "Test" )
image = sf.Image()
image.load_from_file( "foobar.png" )
sprite = sf.Sprite()
sprite.set_image( image )
window.clear( sf.Color( 0x12, 0x34, 0x56 ) )
window.display()
for iterations in (10, 100, 1000, 5000, 10000, 50000, 100000):
start = time.time()
window.clear( sf.Color( 0x12, 0x34, 0x56 ) )
for loop in range( 0, iterations ):
x, y = random.randint( 0, 500 ), random.randint( 0, 500 )
sprite.set_position( x, y )
window.draw( sprite )
window.display()
print u"%d iterations took %.4f seconds." % (iterations, time.time() - start)
print u"Finished."
time.sleep( 1 )
This is just too bad, writing the wrapper via Boost.Python really felt elegant. :/