mattip has quit [Ping timeout: 250 seconds]
mattip has joined #hpy
<mattip> In the conversation with Stefan after the zoom call about Cython +HPy,
<mattip> he suggested we try to go as far as possible with modifying macros rather than creating new node classes
<mattip> for instance, redefining __Pyx_PyInt_As_int(PyObject *) into __Pyx_PyInt_As_int(HPyObject *) when compiling in HPy
<antocuni> does cython always to to __Pyx_* helpers or also call directly the C API?
<antocuni> *always go through
<Hodgestar> mattip: That does sound like a good idea. At least it avoids putting "if ... else ..." a bit everywhere in the node visitors.
<Hodgestar> mattip: I imagine it will have its own challenges though (e.g. we need to pass the ctx).
<mattip> Cython uses 90% wrappers since there are slight differences in CPython versions and compilation strategies
<Hodgestar> fangerer: Dev call minutes skeleton uploaded to the wiki -- https://github.com/hpyproject/hpy/wiki/dev-call-20210902
<Hodgestar> fangerer: We also need to add the names of some of the new faces to the list of attendees, but I didn't know all of them.
<fangerer> thanks, I'll take care of it
phlebas has quit []
phlebas has joined #hpy
<Hodgestar> Tx.
<fangerer> done.
Joannah has joined #hpy
joannah68 has joined #hpy
Joannah has quit [Ping timeout: 256 seconds]
<fangerer> antocuni: As we discussed yesterday, I did a grep through the top4000 to see what C API functions are used. IIRC, you already did that before (or something similar) and just want to know how you did it. I was using `egrep -s -h -o -r '\<_?Py[0-9A-Za-z_]*\('` which will basically look for patterns like `_Py...(` (leading underscore is optional). Does that sound legitimate to you?
<antocuni> the regexp looks good but I was never brave enough to try such an automated way of extracting all functions
<antocuni> what I meant in the call is that when we need to decide whether to introduce a certain API or not, it might be useful to see if and how often it is used in the real world
<antocuni> and to use top4000 as a guidance
<antocuni> e.g. I expect things like PyList_Append and PyDict_Values to be used a lot so they should be fine to include, but maybe there are more obscure APIs which are not worth the assle
<antocuni> there is also the case of APIs which are probably used a lot but there they have a simpler and more generic equivalent. E.g. HPyDict_Size can probably be replaced by HPy_Len
<fangerer> sure, and I already have some results. The most frequently used _func_ is `Py_DECREF` (7148 of 79334 calls; so ~10%). While `PyList_Append` is called 279 -- 0.35 %.
<fangerer> my question is: I'm now grepping for calls; is that the right metric? should we maybe have a metric like _used in n modules_ ?
<antocuni> that's a good question for which I don't have an answer :)
<fangerer> okay, I'll think about it (or wait for other opinions)
<fangerer> here is the list of top100 used C API functions (used in the top4000 packages): https://paste.opendev.org/show/bPLIEafAmoHq5prb9F8f/
<fangerer> btw. this is just preliminary; the list also contains functions from packages that follow the same naming scheme. For instance, `PyUFunc_FromFuncAndDataAndSignature` is not a C API function (I think it is from Numpy).
<antocuni> yes, I also had this problem in my greps
<fangerer> I plan to do the grep on CPython's code and then do the intersection
<antocuni> the good news is that it seems that we already support and/or it's easy to add support for most of the most frequent functions
<fangerer> yes
<antocuni> and for some we already have a working alternative (e.g. PyTuple_SET_ITEM vs HPyTupleBuilder)
<fangerer> I think Simons idea about introducing `HPy_CallMethod` is nice because this would cover a lot of very specific APIs and is also probably not too bad in terms of performance
<fangerer> * Simon's
<fangerer> I'll add this one (next week)
<fangerer> have a nice weekend !
<antocuni> well, I'm not sure about performance
<fangerer> 🙂 because you are thinking of CPython
<antocuni> yes of course. The first goal is to avoid any overhead on CPython, else people will find excuses not to migrate :)
<fangerer> Okay, we can always add more specific APIs
<antocuni> yes, I think that it's ok to have things like HPyList_Append
<fangerer> I'm out for today, cu 👋
joannah68 has quit [Ping timeout: 256 seconds]
<antocuni> have a nice weekend
antocuni has quit [Ping timeout: 248 seconds]
antocuni has joined #hpy