pyodide/cpython
Hood Chatham 73bcf49a3d
PERF Optimize away temporary when making method calls on JsProxy (#4963)
This switches it so that when we call `jsobj.f()` instead of introspecting what
operations are possible on `jsobj.f` and creating an appropriate
callable `JsProxy` corresponding to the bound method, then calling this bound
method, then destroying the `JsProxy`, `_PyObject_GetMethod(jsobj, f_unicode)`
will now return a funny temporary object. We always use the same object so that
we don't need to allocate or destroy anything, and we know it must be
immediately called so we only check if the object is indeed callable.

This makes a HUGE difference to the efficiency of calling a method on a JsProxy,
reducing the time it takes by about 80%.

We assume that the return value of `_PyObject_GetMethod` is only expected to be
callable. In practice, it is only ever used once and then destroyed so we use
this to allow us to repeatedly reuse the same helper object.
2024-07-28 12:59:17 +02:00
..
patches PERF Optimize away temporary when making method calls on JsProxy (#4963) 2024-07-28 12:59:17 +02:00
Makefile Make sysconfigdata relocatable (#4573) 2024-02-27 22:12:23 -08:00
README.md Link to @dgym 2019-03-18 21:33:32 -07:00
Setup.local Python3.11 (#3252) 2023-01-23 19:45:59 -08:00
adjust_sysconfig.py Change wheel tag from emscripten to pyodide (#4777) 2024-05-21 12:30:01 -04:00

README.md

Credits

Based on the hard work of @dgym on cpython-emscripten.