GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||||||||||||||
GeezerVison is showing github.com — GH-94108: Specialize for int & operation by kumaraditya303 · Pull Request #94109 · python/cpython Conversation
|
| Benchmark | base | patch |
|---|---|---|
| int & | 18.2 ns | 16.8 ns: 1.08x faster |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Is The number of We have discussed having some sort of double-dispatching mechanism and cache, to allow fast dispatching of binary operators without an explosion of instructions, but I can't find the original discussion. Maybe @brandtbucher can find it? The general idea is that we register a C function as an implementation of a binary operation for a specific pair of classes and operator. For example, we could register We'd probably keep the specific specializations for the most common operations, like |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Looking at the stats shows the |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
I created this PR based on stats and 33% (largest failure) seemed significant to me but if you don't think this is worth it, I have no objection if you reject this :). |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
I'm not rejecting this. I'm just not sure whether it is a good idea. I'm going to benchmark it first. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Pyperformance shows a small speedup, but close to noise. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Here you go: faster-cpython/ideas#162 |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Yeah, I made a pass at this a few months ago. Even adding in shift operations, I wasn't able to get above "1.00x faster". I'm skeptical of adding lots of additional code here for negligible gain. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
I'm inclined to reject this in favor of a table based approach: faster-cpython/ideas#162. The table based approach won't give as much of a speedup per specialization, but will allow many more specializations for fewer new opcodes. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.