Message387346
> It is a kind of optimization.
PyLong_Check is very fast (only one comparison, AFAICS), so there is no gain in first doing PyLong_CheckExact and then PyLong_Check. Ditto for unicode.
PyFloat_Check is the most expensive check, but it comes before both PyUnicode_Check and PyObject_CheckBuffer (both a lot faster), so that's AFAICS the opposite of an optimisation. Correct me if I'm wrong.
If we want to optimise it we should do PyLong_Check, PyUnicode_Check, PyObject_CheckBuffer, and then PyFloat_Check, no?
> there is nothing wrong in it.
True. I'll argue that my suggestion will improve readability and maintainability, which should be worth considering. |
|
Date |
User |
Action |
Args |
2021-02-19 19:59:37 | erlendaasland | set | recipients:
+ erlendaasland, berker.peksag, serhiy.storchaka |
2021-02-19 19:59:37 | erlendaasland | set | messageid: <1613764777.96.0.0989371084815.issue43267@roundup.psfhosted.org> |
2021-02-19 19:59:37 | erlendaasland | link | issue43267 messages |
2021-02-19 19:59:37 | erlendaasland | create | |
|