Skip to content

Conversation

@kmod
Copy link
Collaborator

@kmod kmod commented Jul 28, 2015

with the goal of making sure that most exceptions we throw are CAPI exceptions rather that C++ exceptions. This is just some easy things for now: getattr, getitem, and len(). The plan is then to add runtimeCall, callattr, and then finally add support from the interpreter and/or jit to call the capi-style versions (ideally with some sort of profiling guidance).

For django_template3, these changes cut the number of calls to __cxa_throw from 44k to 27k, and the number of C frames we unwind from 395k to 240k.

Not sure why there's a fairly consistent regression in pyxl_bench; I tried looking into it and it seems dwarfed by variability so I'm punting on that for now.

      django_template3.py             3.8s (2)             3.7s (2)  -2.6%
            pyxl_bench.py             3.0s (2)             3.1s (2)  +1.3%
sqlalchemy_imperative2.py             3.3s (2)             3.3s (2)  +0.5%
                  geomean                 3.4s                 3.4s  -0.3%

kmod added 5 commits July 27, 2015 21:35
The exceptions thrown by len itself can now be either style,
though any exceptions thrown by any called functions (ex __len__)
will still get thrown as C++ exceptions and converted if needed.

Helps in a common case of "try calling len but don't worry if no
len was defined".
For use of PyObject_GetItem

django_template3 ends up calling this a fair amount via unicode_translate
(ie it checks to see if certain entries are in the translation table).
Apparently they can do compile-time evaluations, which is cool.
kmod added a commit that referenced this pull request Jul 28, 2015
start templatizing the runtime to be able to choose exception styles
@kmod kmod merged commit 75e203a into pyston:master Jul 28, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant