Message225821
Le 24/08/2014 04:56, Stefan Krah a écrit :
>
> I'm not sure about OS X, but I would be surprised if it did not work.
>
> To my limited knowledge, Capsules are slow, see also here (the penultimate
> paragraph):
They are slow if you have to lookup and unwrap a capsule every time you
use it. But the way it would work for _decimal (and the way it already
works for _datetime), AFAIK, would be different: you would look up the
"capsule API structure" once and then simply dereference function
pointers from that structure.
You can actually take a look at Include/datetime.h and see if the
approach would work. See especially:
/* Define global variable for the C API and a macro for setting it. */
static PyDateTime_CAPI *PyDateTimeAPI = NULL;
#define PyDateTime_IMPORT \
PyDateTimeAPI = (PyDateTime_CAPI
*)PyCapsule_Import(PyDateTime_CAPSULE_NAME, 0)
which encourages a once-in-a-process-lifetime API lookup pattern.
I don't think a hand-coded dlsym()-based approach can be any
significantly faster. |
|
Date |
User |
Action |
Args |
2014-08-24 14:15:26 | pitrou | set | recipients:
+ pitrou, lemburg, scoder, skrah |
2014-08-24 14:15:26 | pitrou | link | issue22194 messages |
2014-08-24 14:15:26 | pitrou | create | |
|