Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(1841)

Issue 160063: LOAD_METHOD/CALL_METHOD: Avoid allocating bound methods when possible (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
14 years, 4 months ago by Reid Kleckner
Modified:
10 years, 12 months ago
Reviewers:
Collin Winter, bartonspider, Jeffrey Yasskin
CC:
unladen-swallow_googlegroups.com
Visibility:
Public.

Description

This adds two opcodes that the compiler uses when it sees an ast with foo.bar(...). Instead of compiling down to LOAD_ATTR and CALL_FUNCTION, it uses LOAD_METHOD and CALL_METHOD, which try to avoid bound method allocations. Micro results from my MacBook: [reid@bitsaw benchmarks]$ ./perf.py -b calls ../../unladen-trunk/python.exe Report on Darwin bitsaw 9.8.0 Darwin Kernel Version 9.8.0: Wed Jul 15 16:55:01 PDT 2009; root:xnu-1228.15.4~1/RELEASE_I386 i386 i386 Total CPU cores: 2 ### call_method ### Min: 0.583511 -> 0.344393: 1.6943x faster Avg: 0.605230 -> 0.372738: 1.6237x faster Significant (t=43.267534) Stddev: 0.05956 -> 0.02799: 2.1276x smaller Timeline: http://tinyurl.com/2655aog ### call_method_slots ### Min: 0.542620 -> 0.342289: 1.5853x faster Avg: 0.555865 -> 0.353226: 1.5737x faster Significant (t=94.850070) Stddev: 0.01514 -> 0.02134: 1.4089x larger Timeline: http://tinyurl.com/2expp9p ### call_method_unknown ### Min: 0.659792 -> 0.450914: 1.4632x faster Avg: 0.666534 -> 0.456468: 1.4602x faster Significant (t=79.788969) Stddev: 0.02340 -> 0.02219: 1.0545x smaller Timeline: http://tinyurl.com/2ebx4jz ### call_simple ### Min: 0.343156 -> 0.344714: 1.0045x slower Avg: 0.346054 -> 0.351503: 1.0157x slower Significant (t=-4.340172) Stddev: 0.01042 -> 0.01131: 1.0853x larger Timeline: http://tinyurl.com/29888o9 Macro results from my MacBook: [reid@bitsaw benchmarks]$ ./perf.py -b default ../../unladen-trunk/python.exe ../../unladen-swallow/python.exe Report on Darwin bitsaw 9.8.0 Darwin Kernel Version 9.8.0: Wed Jul 15 16:55:01 PDT 2009; root:xnu-1228.15.4~1/RELEASE_I386 i386 i386 Total CPU cores: 2 ### 2to3 ### 23.578751 -> 22.740652: 1.0369x faster ### django ### Min: 0.694497 -> 0.680717: 1.0202x faster Avg: 0.696787 -> 0.682056: 1.0216x faster Significant (t=47.982199) Stddev: 0.00207 -> 0.00064: 3.2371x smaller Timeline: http://tinyurl.com/2dn7b57 ### nbody ### Min: 0.263677 -> 0.263671: 1.0000x faster Avg: 0.269985 -> 0.269915: 1.0003x faster Not significant Stddev: 0.03479 -> 0.03463: 1.0045x smaller Timeline: http://tinyurl.com/24bdsdt ### slowpickle ### Min: 0.494245 -> 0.466987: 1.0584x faster Avg: 0.523489 -> 0.496445: 1.0545x faster Not significant Stddev: 0.10970 -> 0.11131: 1.0148x larger Timeline: http://tinyurl.com/25lamlj ### slowspitfire ### Min: 0.638928 -> 0.640723: 1.0028x slower Avg: 0.645053 -> 0.642255: 1.0044x faster Significant (t=7.250180) Stddev: 0.00265 -> 0.00064: 4.1290x smaller Timeline: http://tinyurl.com/25brxnx ### slowunpickle ### Min: 0.240180 -> 0.242001: 1.0076x slower Avg: 0.256118 -> 0.258107: 1.0078x slower Not significant Stddev: 0.05250 -> 0.05317: 1.0129x larger Timeline: http://tinyurl.com/2euyyaa ### spambayes ### Min: 0.268789 -> 0.259132: 1.0373x faster Avg: 0.365989 -> 0.355499: 1.0295x faster Not significant Stddev: 0.30451 -> 0.30113: 1.0112x smaller Timeline: http://tinyurl.com/23y7f8x

Patch Set 1 #

Patch Set 2 : lots of work #

Patch Set 3 : Update past opcode refactoring. #

Patch Set 4 : Small cleanups #

Patch Set 5 : Merge w/ trunk, fix test_profile #

Unified diffs Side-by-side diffs Delta from patch set Stats (+1274 lines, -382 lines) Patch
M Include/classobject.h View 2 3 4 1 chunk +1 line, -0 lines 0 comments Download
M Include/descrobject.h View 1 2 3 4 2 chunks +4 lines, -2 lines 0 comments Download
M Include/frameobject.h View 2 3 4 1 chunk +2 lines, -0 lines 0 comments Download
M Include/methodobject.h View 1 2 3 4 3 chunks +10 lines, -1 line 0 comments Download
M Include/object.h View 1 2 3 4 1 chunk +2 lines, -0 lines 0 comments Download
M Include/opcode.h View 1 2 3 4 2 chunks +3 lines, -2 lines 0 comments Download
M JIT/PyBytecodeDispatch.h View 3 4 2 chunks +2 lines, -0 lines 0 comments Download
M JIT/PyBytecodeDispatch.cc View 3 4 2 chunks +14 lines, -0 lines 0 comments Download
M JIT/PyTypeBuilder.h View 3 4 2 chunks +17 lines, -0 lines 0 comments Download
M JIT/RuntimeFeedback.h View 3 4 4 chunks +13 lines, -6 lines 0 comments Download
M JIT/RuntimeFeedback.cc View 3 4 5 chunks +59 lines, -44 lines 0 comments Download
M JIT/llvm_compile.cc View 3 4 1 chunk +2 lines, -0 lines 0 comments Download
M JIT/llvm_fbuilder.h View 3 4 2 chunks +9 lines, -1 line 0 comments Download
M JIT/llvm_inline_functions.c View 3 4 6 chunks +117 lines, -25 lines 0 comments Download
M JIT/opcodes/attributes.h View 3 4 4 chunks +7 lines, -1 line 0 comments Download
M JIT/opcodes/attributes.cc View 3 4 4 chunks +172 lines, -6 lines 0 comments Download
M JIT/opcodes/call.h View 3 4 3 chunks +2 lines, -2 lines 0 comments Download
M JIT/opcodes/call.cc View 3 4 11 chunks +149 lines, -44 lines 0 comments Download
M Lib/opcode.py View 1 2 3 4 2 chunks +3 lines, -1 line 0 comments Download
M Lib/test/test_llvm.py View 2 3 4 2 chunks +148 lines, -1 line 0 comments Download
M Modules/_lsprof.c View 5 chunks +42 lines, -24 lines 0 comments Download
M Objects/classobject.c View 2 3 4 1 chunk +34 lines, -18 lines 0 comments Download
M Objects/descrobject.c View 1 2 3 4 7 chunks +54 lines, -51 lines 0 comments Download
M Objects/methodobject.c View 1 2 3 4 6 chunks +47 lines, -31 lines 0 comments Download
M Objects/object.c View 2 3 4 4 chunks +165 lines, -69 lines 0 comments Download
M Python/compile.c View 1 2 3 4 4 chunks +20 lines, -1 line 0 comments Download
M Python/eval.cc View 1 2 3 4 17 chunks +174 lines, -50 lines 0 comments Download
M Python/opcode_targets.h View 1 2 3 4 2 chunks +2 lines, -2 lines 0 comments Download

Messages

Total messages: 3
Reid Kleckner
I updated this patch and re-ran the benchmarks and it showed a real speedup! PTAL.
13 years, 10 months ago (2010-06-13 18:28:06 UTC) #1
Reid Kleckner
Ping?
13 years, 9 months ago (2010-07-07 17:46:02 UTC) #2
bartonspider_gmail.com
10 years, 12 months ago (2013-04-21 01:53:35 UTC) #3
Hello I'm looking for satelite relay recevicer will purchase please give 
quote in full detail contact info is as follows vipervemoncobra@gmail.comcan
complete transaction as follows first come first serve need one to 
start thanks. 
On Wednesday, July 7, 2010 11:46:03 AM UTC-6, rkleckner wrote:
>
> Ping?
>
> http://codereview.appspot.com/160063/show
>
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b