Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Question about the Python binding  (Read 7435 times)

0 Members and 1 Guest are viewing this topic.

blewisjr

  • Newbie
  • *
  • Posts: 23
    • View Profile
Question about the Python binding
« on: November 09, 2013, 12:03:49 am »
Hello Everyone,

I have not posted on these forums in years.  I am recently getting back into game development and I remembered SFML.  I was thinking about using the python version.  The only concern I have is performance as I am unfamiliar with cython.  When I use to drop to C in my python code I always have used ctypes as it was easy to do right from python itself.

How is the performance of pysfml using cython?  Also I notice you recommend using the VC++ compiler that python was built with?  Would I have a negative impact if I use MinGW instead? 

I like to try and stick to one compiler if possible for interfacing with C when I have to because it is a pain to chase around which VC++ compiler python is built with.

Sorry if my questions are horrid I have not touched python in quite a while I was on a Micro Electronics binge programming in C.

Sonkun

  • Moderator
  • Full Member
  • *****
  • Posts: 241
    • View Profile
Re: Question about the Python binding
« Reply #1 on: November 09, 2013, 07:58:26 am »
Hi,

Why are people so obsessed about performances :p You won't notice any difference. Just expect your program to run slightly slower but that's just because Python is interpreted while C++ is compiled. If you write stuff that takes time to compute, it will likely  run slow in both C++ and Python because SFML just sends stuff to the GPU which executes its tasks independently of the languages you use.

The official Python installers install a Python version compiled with these compilers so we need to use the same one. It's advised.. or you may encounter mysterious bugs/crashes.

Good luck :)
Interested in using SFML with Python ? Try out its Python binding!

blewisjr

  • Newbie
  • *
  • Posts: 23
    • View Profile
Re: Question about the Python binding
« Reply #2 on: November 09, 2013, 12:32:45 pm »
Hi,

Why are people so obsessed about performances :p You won't notice any difference. Just expect your program to run slightly slower but that's just because Python is interpreted while C++ is compiled. If you write stuff that takes time to compute, it will likely  run slow in both C++ and Python because SFML just sends stuff to the GPU which executes its tasks independently of the languages you use.

The official Python installers install a Python version compiled with these compilers so we need to use the same one. It's advised.. or you may encounter mysterious bugs/crashes.

Good luck :)

Thanks for the information and the reply.  As for why are people obsessed about performance.  I have an excuse I have been developing for micro controllers for the last 2 years as a hobby.  ::)  I would still not say I am obsessed I just know from experience that Python can really bog down computationally well before a solid C/C++ algorithm does.  I just wanted to make sure I was not going to run into any other potential slow downs.  I.E. Significant Python -> C call overhead.  I should have specified better in my post besides just saying I am unfamiliar with Cython.

Either way thanks for the reply I will continue to look into this.