leonhd / unladen-swallow

Automatically exported from code.google.com/p/unladen-swallow
Other
1 stars 1 forks source link

Create functions for Python/getargs.c arg parsing #143

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
With METH_ARG_RANGE it becomes tedious rather quickly to have to inline the 
code from getargs.c for each possible argument. It would be good to break 
that code out into functions for easier use.

But that will increase function calls relative to the # of arguments to a 
function. That means that it's possible the code will have to be turned into 
macros if the performance drops too much.

Original issue reported on code.google.com by bcannon on 23 Feb 2010 at 12:12

GoogleCodeExporter commented 8 years ago
Splitting out what the code that handles arguments into functions and adding 
METH_ARG_RANGE to fileobject.c and cStringIO.c led to nbody speeding up by 14% 
but Django slowing down by 1.5% (which perf.py says is significant). Don't know 
if 
you want to pursue this any farther if it is already hurting performance just 
for 'l', 'n', 
'i', 's*' and 't#'. If you do then I will upload the patch.

Report on Darwin Bretts-MacBook.local 10.2.0 Darwin Kernel Version 10.2.0: Tue 
Nov  3 10:37:10 PST 2009; root:xnu-1486.2.11~1/RELEASE_I386 i386 i386
Total CPU cores: 2

### 2to3 ###
26.106773 -> 26.376297: 1.0103x slower

### django ###
Min: 0.868641 -> 0.883641: 1.0173x slower
Avg: 0.871262 -> 0.885701: 1.0166x slower
Significant (t=-38.561051)
Stddev: 0.00187 -> 0.00187: 1.0013x larger
Timeline: http://tinyurl.com/ycupeo3

### nbody ###
Min: 0.262198 -> 0.229644: 1.1418x faster
Avg: 0.281684 -> 0.236454: 1.1913x faster
Significant (t=5.652687)
Stddev: 0.03966 -> 0.04036: 1.0177x larger
Timeline: http://tinyurl.com/ycwsozq

### slowpickle ###
Min: 0.570950 -> 0.538644: 1.0600x faster
Avg: 0.614124 -> 0.570064: 1.0773x faster
Not significant
Stddev: 0.11660 -> 0.11699: 1.0033x larger
Timeline: http://tinyurl.com/y9k65r9

### slowspitfire ###
Min: 0.769860 -> 0.770770: 1.0012x slower
Avg: 0.787335 -> 0.787531: 1.0002x slower
Not significant
Stddev: 0.01420 -> 0.01539: 1.0838x larger
Timeline: http://tinyurl.com/yjw8lza

### slowunpickle ###
Min: 0.203898 -> 0.213453: 1.0469x slower
Avg: 0.220441 -> 0.230522: 1.0457x slower
Not significant
Stddev: 0.05589 -> 0.05603: 1.0025x larger
Timeline: http://tinyurl.com/yzvz7p9

### spambayes ###
Min: 0.283471 -> 0.285151: 1.0059x slower
Avg: 0.400042 -> 0.402111: 1.0052x slower
Not significant
Stddev: 0.41401 -> 0.41390: 1.0003x smaller
Timeline: http://tinyurl.com/yht49d4

Original comment by bcannon on 25 Feb 2010 at 8:57

GoogleCodeExporter commented 8 years ago
Brett, please go ahead and upload a patch!  20% is pretty big and 1.5% is 
pretty small 
(significant or not) and we can certainly ameliorate that by switching to 
macros, etc.

Original comment by alex.gay...@gmail.com on 25 Feb 2010 at 11:09