arvindm95 / unladen-swallow

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

FDO: specialize operators using type feedback #73

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
The feedback-gathering code added in r778 allows us to track the input types 
of the binary and unary operators (among other opcodes). We should use this 
data to generate smarter machine code: inlining integer addition, rather than 
calling PyNumber_Add(); calling string_concat() instead of PyNumber_Add() for 
strings; etc. This will be far more valuable than doing "if (guard_1) foo(); 
else 
if (guard_2) bar(); else generic_fallback()"-style static prediction.

Original issue reported on code.google.com by collinw on 25 Jul 2009 at 9:14

GoogleCodeExporter commented 8 years ago

Original comment by collinw on 26 Sep 2009 at 12:05

GoogleCodeExporter commented 8 years ago

Original comment by collinw on 6 Jan 2010 at 11:43

GoogleCodeExporter commented 8 years ago
r957 implemented specializations for some important operator/type combinations:

- List subscription with an integer index.
- Int/int addition, subtraction, multiplication, division and modulus.
- Float/float addition, subtraction, multiplication, division and modulus.

Benchmark highlights:

### nbody ###
Min: 0.445511 -> 0.280253: 1.5897x faster
Avg: 0.455251 -> 0.284752: 1.5988x faster
Significant (t=46.861686, a=0.95)
Stddev: 0.02193 -> 0.02903: 1.3240x larger
Timeline: http://tinyurl.com/yeyo6gs

All other benchmarks were unchanged.

There are still other operator/type combinations that might be valuable (needs 
profiling), such 
as % for strings and tuple subscription.

Original comment by collinw on 7 Jan 2010 at 12:30

GoogleCodeExporter commented 8 years ago
r1046 added specialization for float/int multiplication and division.

Original comment by collinw on 28 Jan 2010 at 12:03

GoogleCodeExporter commented 8 years ago
r1060 added specialization for tuple indexing.

Original comment by collinw on 30 Jan 2010 at 1:06

GoogleCodeExporter commented 8 years ago
r1069 added specialization for string and unicode formatting.

Original comment by collinw on 3 Feb 2010 at 5:52

GoogleCodeExporter commented 8 years ago

Original comment by collinw on 21 Feb 2010 at 6:06