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.
Comment #1
Posted on Sep 26, 2009 by Helpful Elephant(No comment was entered for this change.)
Comment #2
Posted on Jan 6, 2010 by Helpful Elephant(No comment was entered for this change.)
Comment #3
Posted on Jan 7, 2010 by Helpful Elephantr957 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.
Comment #4
Posted on Jan 28, 2010 by Helpful Elephantr1046 added specialization for float/int multiplication and division.
Comment #5
Posted on Jan 30, 2010 by Helpful Elephantr1060 added specialization for tuple indexing.
Comment #6
Posted on Feb 3, 2010 by Helpful Elephantr1069 added specialization for string and unicode formatting.
Comment #7
Posted on Feb 21, 2010 by Helpful Elephant(No comment was entered for this change.)
Status: Started
Labels:
Type-Enhancement
Priority-Medium
Performance