-
Notifications
You must be signed in to change notification settings - Fork 36
Pyray : convert function arguments based on c function signature #53
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
base: master
Are you sure you want to change the base?
Conversation
just found a bug using this. some arguments expect pointers but can be given non ffi pointers ; |
not the best fix but it works |
found a way to check on type rather than str(type) should be robust and work with dynamic since the C_POINTER type we check is determined in pyRay init |
This looks like quite a major change so will probably take me a while to review it. Let me know when it’s finished anyway. |
The implementation change is around 15 loc, only in pyray/init.py |
oh yeah and it's pretty much finished afaik, |
Example is added, thanks. I had to add an unsigned int* to satisfy Raylib though, |
oh i see, you wrote a special case for that call to add the unsigned int*. i don't really want to be special casing anything. |
do you have a benchmark that shows a difference for the changes to pyray/init.py ? |
61ee4cf
to
3b01e59
Compare
568da0c
to
22af403
Compare
Hi,
while testing the Pyray module I stumbled upon your comment about function calls using a lot of string comparisons at runtime, so here's an alternative that basically converts python arguments to the type expected by the c function.
Interestingly I have not found that great a performance improvement on the script I tested it on (~3%)
but at least we don't inspect the c function at each call anymore.
keep being awesome !