Not-Nik / raylib-zig

Manually tweaked, auto-generated raylib bindings for zig. https://github.com/raysan5/raylib
MIT License
517 stars 102 forks source link

High CPU usage running the basic window example #2

Closed lluz55 closed 4 years ago

lluz55 commented 4 years ago

Zig bindings: zig raylib cpu usage

Go bindings: go raylib cpu usage

Not-Nik commented 4 years ago

Not quite sure where this comes from. I tried running the basic window example with both the plain C source and in Zig and they have about the same CPU usage. Also when you look at the binding all it really does is define extern functions, structs and enums so nothing that could really impact CPU usage.

Screen Shot 2020-05-03 at 22 37 05
raysan5 commented 4 years ago

Check raylib/src/config.h, comment SUPPORT_BUSY_WAIT_LOOP and SUPPORT_HALF_BUSY_WAIT_LOOP

lluz55 commented 4 years ago

Also when you look at the binding all it really does is define extern functions, structs and enums so nothing that could really impact CPU usage.

I know. I just wanted to have some idea of ​​what could be doing this. I tested with Nim bindings and it shares similar result as in Go

Not-Nik commented 4 years ago

Closing this as the binding no longer depends on a pre-installed raylib version.

rcorre commented 3 years ago

FWIW, I encountered this on Linux raylib 3.7 zig 0.8. Commenting out SUPPORT_HALF_BUSY_WAIT_LOOP dropped the CPU to near-0.