Neil Schemenauer schrieb am 12.09.2018 um 09:16:
I was curious about how much slower CPython will be now that I'm using functions for Py_Type(), Py_INCREF(), etc. Some quick and dirty benchmark seems to show it is not so bad, maybe about 10% slower.
Well, you'd expect a visible performance hit here. It's a very common thing to quickly check exactly for a couple of likely types via "ob_type" and then do something type specific. If that "quick check" now takes serious effort, than it turns all sorts of prior speedups into expensive operations.
So, if the goal is to make this common operation slow, what alternative do you envison for getting back an "almost no cost" type check?