Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Use AC vectorcall support for the :class:`decimal.Decimal`. This offers
~1.15x speedup on creation of small instances.
4 changes: 3 additions & 1 deletion Modules/_decimal/_decimal.c
Original file line number Diff line number Diff line change
Expand Up @@ -3313,6 +3313,7 @@ PyDec_FromObject(PyObject *v, PyObject *context)
}

/*[clinic input]
@vectorcall
@classmethod
_decimal.Decimal.__new__ as dec_new

Expand All @@ -3329,7 +3330,7 @@ trap is active.

static PyObject *
dec_new_impl(PyTypeObject *type, PyObject *value, PyObject *context)
/*[clinic end generated code: output=35f48a40c65625ba input=5f8a0892d3fcef80]*/
/*[clinic end generated code: output=35f48a40c65625ba input=0e5ca99183562cd9]*/
{
decimal_state *state = get_module_state_by_def(type);
CONTEXT_CHECK_VA(state, context);
Expand Down Expand Up @@ -6190,6 +6191,7 @@ static PyType_Slot dec_slots[] = {
{Py_tp_methods, dec_methods},
{Py_tp_getset, dec_getsets},
{Py_tp_new, dec_new},
{Py_tp_vectorcall, dec_vectorcall},

// Number protocol
{Py_nb_add, nm_mpd_qadd},
Expand Down
51 changes: 46 additions & 5 deletions Modules/_decimal/clinic/_decimal.c.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading