ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> pygame-users
pygame-users
Re: [pygame] Pygame's future beyond 1.8
by Alex Holkner other posts by this author
Aug 21 2006 4:04AM messages near this date
Re: [pygame] Pygame's future beyond 1.8 | Re: [pygame] Pygame's future beyond 1.8
Marcus von Appen wrote:

> On, Mon Aug 21, 2006, Alex Holkner wrote:
> 
> [...]
>  
>   
> 
> >In the more general case, the small amount of Python wrapper that exists 
> >on every Pygame-ctypes function will indeed make it perform slower than 
> >its Pygame counterpart.  I would argue that if this small performance 
> >penalty is significant for a particular project, then that project is 
> >not really suited to be implemented in Python.
> >    
> >
> 
> If a small penalty of e.g. 0.5ms in a function exists and this function
> is called 50 times in your project code you'll have a total penalty of
> 2.5 ms already. Now let's assume, this function is (or must be) called
> periodically...
> If the author now mourns about that, are you going to tell him, that
> his projects is not suited to be implemented in Python?
>   
> 
Of course your argument can be applied to any arbitrary-sized problem, 
but I thought I would clarify the figures.  The overhead of 
Pygame-ctypes that is directly a result of using ctypes (see below) is 
0.22 microseconds---several orders of magnitude less than your example.  
For comparison, the cost of a single addition is 0.07 microseconds.

Tests conducted on AMD64 3500, GCC 3.4.3, Linux 2.6.14, Python 2.5 beta 
3 (64-bit), Pygame-ctypes r938, Pygame r938, SDL 1.2.11.

Pygame:
python2.5 -OO -m timeit -s 'import pygame; pygame.init()' 
'pygame.time.get_ticks()'
1000000 loops, best of 3: 0.47 usec per loop

SDL-ctypes:
python2.5 -OO -m timeit -s 'import SDL; 
SDL.SDL_Init(SDL.SDL_INIT_TIMER)' 'SDL.SDL_GetTicks()'
1000000 loops, best of 3: 0.694 usec per loop

Pygame-ctypes: (performs additional checking)
python2.5 -OO -m timeit -s 'import pygame; pygame.init()' 
'pygame.time.get_ticks()'
100000 loops, best of 3: 2.3 usec per loop

Simple addition only:
python2.5 -OO -m timeit '1+1'
10000000 loops, best of 3: 0.0714 usec per loop

> Saying things like that basically means, that you do not understand the
> pitfalls of software dependencies and how to deal with them.
>   
> 
Alex.
Thread:
Richard Jones
renesd
Peter Shinners
renesd
Greg Ewing
Richard Jones
John Eriksson
Simon Wittber
Richard Jones
renesd
Alex Holkner
Marcus von Appen
Phil Hassey
Marcus von Appen
Alex Holkner
renesd
Phil Hassey
renesd
Marcus von Appen
Luke Paireepinart
renesd
Flyaflya
Alex Holkner
Phil Hassey
Rikard Bosnjakovic
Alex Holkner
James Paige
Phil Hassey
Peter Shinners
Richard Jones

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved