Commit b7a57379 authored by Kevin Modzelewski's avatar Kevin Modzelewski

microoptimizations

parent bcae726c
...@@ -76,7 +76,7 @@ void BoxedFloat::tp_dealloc(Box* b) noexcept { ...@@ -76,7 +76,7 @@ void BoxedFloat::tp_dealloc(Box* b) noexcept {
#ifdef DISABLE_INT_FREELIST #ifdef DISABLE_INT_FREELIST
b->cls->tp_free(b); b->cls->tp_free(b);
#else #else
if (PyFloat_CheckExact(b)) { if (likely(PyFloat_CheckExact(b))) {
PyFloatObject* v = (PyFloatObject*)(b); PyFloatObject* v = (PyFloatObject*)(b);
v->ob_type = (struct _typeobject *)free_list; v->ob_type = (struct _typeobject *)free_list;
free_list = v; free_list = v;
......
...@@ -439,7 +439,7 @@ static void subtype_dealloc(Box* self) noexcept { ...@@ -439,7 +439,7 @@ static void subtype_dealloc(Box* self) noexcept {
PyObject_ClearWeakRefs(self); PyObject_ClearWeakRefs(self);
/* Maybe call finalizer; exit early if resurrected */ /* Maybe call finalizer; exit early if resurrected */
if (type->tp_del) { if (unlikely(type->tp_del)) {
_PyObject_GC_TRACK(self); _PyObject_GC_TRACK(self);
type->tp_del(self); type->tp_del(self);
if (self->ob_refcnt > 0) if (self->ob_refcnt > 0)
...@@ -461,7 +461,7 @@ static void subtype_dealloc(Box* self) noexcept { ...@@ -461,7 +461,7 @@ static void subtype_dealloc(Box* self) noexcept {
/* Clear slots up to the nearest base with a different tp_dealloc */ /* Clear slots up to the nearest base with a different tp_dealloc */
base = type; base = type;
while (base->tp_dealloc == subtype_dealloc) { while (base->tp_dealloc == subtype_dealloc) {
if (Py_SIZE(base)) if (unlikely(Py_SIZE(base)))
clear_slots(base, self); clear_slots(base, self);
base = base->tp_base; base = base->tp_base;
assert(base); assert(base);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment