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

raylib-lua is slow on Apple M1 #5

Open
GarrettAlbright opened this issue Jul 23, 2022 · 6 comments
Open

raylib-lua is slow on Apple M1 #5

GarrettAlbright opened this issue Jul 23, 2022 · 6 comments
Labels
bug Something isn't working help wanted Extra attention is needed

Comments

@GarrettAlbright
Copy link

GarrettAlbright commented Jul 23, 2022

I'm on a MacBook Air (M1, 2020) running macOS 12.4.

After cloning the repo and subrepos and running make, trying to run any of the raylua_* binaries results in:

zsh: killed     ./raylua_e

(…or raylua_s or raylua_r) and an exit code of 137.

Searching for "zsh: killed" seems to mostly result in pages relating to running Homebrew or tools installed with it on M1 Macs. I don't think this is Homebrew-related since I'm a boomer who uses MacPorts (if it ain't broke…). Nonetheless I wonder if the issue might still be related to the relatively new M1 hardware and I wonder if anyone else is seeing this issue happen on M1 Macs, or alternatley is running it successfully.

Unfortunately I no longer have easy access to Intel-based Mac hardware to see if the issue is happening there too.

@TSnake41 TSnake41 added bug Something isn't working help wanted Extra attention is needed labels Sep 29, 2022
@TSnake41
Copy link
Owner

Exit code 137 is out of memory error, not sure why/where it happens.

I don't have a Mac, so it's tricky to test, I should try with a vm.

@atahrijouti
Copy link

👋🏼 @GarrettAlbright
Have you find out a way to work with it?

@GarrettAlbright
Copy link
Author

I'm afraid I haven't. I haven't had another look at this since I posted this issue.

@joseph-montanez
Copy link
Contributor

I've submitted a pull request for the issue, but one thing I am noticing is performance is not great. Here is a benchmark I've run 100,000 bunnies, 144 FPS max.

M1 Mac Mini - 16GB RAM - macOS Ventura 13.4.1

Language Extension FPS Memory CPU GPU
C (CMake Release) Native 85 FPS 47 MB 64% 90%
Zig 0.11.0 (ReleaseFast) (Arena) raylib.zig 85 FPS 54 MB 60% 90%
Rust (Release) bitten2up/raylib-rs 85 FPS 48 MB 67% 90%
Go 2.20 (Release) gen2brain/raylib-go 85 FPS 55 MB 73% 90%
Nim 2.0 (Release) planetis-m/naylib 83 FPS 48 MB 70% 90%
C# 11 .Net 7 raylib-cs 85 FPS 68 MB 75% 90%
NodeJS 20 node-raylib 44 FPS 134 MB 100% 80%
PHP 8.2 (Jit) raylib-php 41 FPS 257 MB 100% 60%
PHP 8.2 raylib-php 27 FPS 242 MB 100% 57%
Python 3.11 raylib-python-cffi 10 FPS 100 MB 100% 35%
Lua (LuaJIT 2.1.0-beta3) (-O2) TSnake41/raylib-lua 5 FPS 113 MB 100% 31%

I am not sure why LuaJIT is having these performance issues as I ran raylib_e with a zipfile to make a binary. The branch checkout is from 6 months ago so its a recent code base for LuaJIT. Even ran with MACOSX_DEPLOYMENT_TARGET=13.4 make to try anything for additional performance. Also used -arch arm64 -O3 -flto but nothing really improved performance.

@TSnake41
Copy link
Owner

TSnake41 commented Aug 12, 2023

I think this issue is due to LuaJIT on Mac OS not using JIT for some reason.
What gives jit.status() (may require jit = require "jit") on Mac OS X with M1/M2 ?

@joseph-montanez
Copy link
Contributor

jit = require "jit"

print("jit status", jit.status())

 ./raylua_s examples/textures_bunnymark.lua           
RAYLUA: Raylua boot script
RAYLUA: Lua Version: Lua 5.1
RAYLUA: Lua JIT: LuaJIT 2.1.0-beta3
RAYLUA: Loading FFI binding entries.
RAYLUA: Loaded 846 FFI entries.
jit status	true	fold	cse	dce	fwd	dse	narrow	loop	abc	sink	fuse

@TSnake41 TSnake41 changed the title "zsh: killed" raylua_* binaries (M1 issue?) raylib-lua is slow on Apple M1 Aug 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

4 participants