Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve trace callback performance #115

Open
pschanely opened this issue Sep 9, 2021 · 3 comments
Open

Improve trace callback performance #115

pschanely opened this issue Sep 9, 2021 · 3 comments

Comments

@pschanely
Copy link
Owner

As described here, CrossHair spends a lot of its execution time in a pure-python sys.settrace handler. Making this faster should speed up CrossHair quite a bit.

It would be great to benchmark how much would be saved by moving some of that logic to an extension module written in C; it wouldn't be possible to move all the logic, but many tracing invocations are no-ops, and avoiding those at least could help a lot. Cython might also be worth investigating.

@IssueHuntBot
Copy link

@amacfie has funded $100.00 to this issue.


@pschanely
Copy link
Owner Author

Thank you for the bounty, @amacfie!
To make the task a little more concrete, the logic in this function is, more or less, what we'd want to implement at the C level.

Honestly, the biggest challenge here might be to preserve the easy, fast, and frustration-free packaging and installation process that CrossHair currently enjoys.

We use github actions to package/publish when a release is tagged. Once we add this extension module, we'll need to build and publish binary wheels. I'd want to support the same platforms that z3 does, and retain our current level of automation (probably with GitHub actions). I believe GitHub actions has runners for windows and mac, so I think this is achievable, maybe with some help from cibuildwheel. (though the last time I investigated this, it wasn't as trivial to get working as I'd hoped)

@pschanely
Copy link
Owner Author

Much of this is now implemented, but there are two more valuable changes:
(1) We should port the many different ways to do a stack read and write to C. In theory, the resulting code should be faster, smaller, and more correct/portable, because the ctypes approach we have now is overly dependent on the byte-level layout of the frame struct.
(2) CompositeTracer is now largely just a wrapper around CTracer. Let's try to remove the CompositeTracer layer entirely.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants