ptitSeb / box64

Box64 - Linux Userspace x86_64 Emulator with a twist, targeted at ARM64 Linux devices
https://box86.org
MIT License
3.43k stars 245 forks source link

Very poor performance and spikes on Factorio #316

Open zoeleu opened 2 years ago

zoeleu commented 2 years ago

Here are two benchmarks with and without box64, is this normal? Is this the expected performance or is there an issue I am not seeing?

https://browser.geekbench.com/v5/cpu/15195678 https://browser.geekbench.com/v5/cpu/15195624

I have also seen many hiccups and performance spikes with Factorio servers.

I am running Oracle Ampere A1 Server CPUs.

zoeleu commented 2 years ago

My guess is that since Factorio is statically linked, Box64 can't find the native libraries to wrap and use.

ptitSeb commented 2 years ago

I don't really like the title of ticket. Why do you think this is "very poor" performance? GeekBench 5 is running at 40% of native speed, roughly. IIRC, the AES score is really low, even if box64 handle AES-NI extension using the AES aarch64 extension. Not sure why the score is so low. Do you have some better emulator maybe?

zoeleu commented 2 years ago

I misformulated my issue, and for that I am sorry. The performance issues are with Factorio and I used geekbench statistics. My CPU spikes up to 400% at random moments and the players crash. This does not happen on an x86_64 CPU.

zoeleu commented 2 years ago

Here is the headless build I am using: factorio.tar.xz

zoeleu commented 2 years ago

Here is a list of symbols in Factorio. factorio_symbols.txt

It has a lot of statically linked libraries, I'm guessing this could be the root of the issue.

ptitSeb commented 2 years ago

Have you tried to update box64 latelly? I have improve stability, so I would expect the crash to be solved.

zoeleu commented 2 years ago

Hmm, I'll try it soon

ptitSeb commented 1 year ago

FYI: I have improved the AES-XTS performance of Geekench 5 with latest commit.

Also, I suppose this ticket can be closed now.

zoeleu commented 1 year ago

How would I diagnose performance issues on statically linked binaries?

ptitSeb commented 1 year ago

is that the same ticket?

if you are talking about binaries that use no external libs (no libc, no nothing), than box64 is not compatible with that.

zoeleu commented 1 year ago

Originally this issue was about Factorio, the game, but I used Geekbench to showcase the performance downgrade for some reason I can't remember.

Yes, it uses libc dynamically, but glad and a couple other libraries related to cryptography (ssl, aes, tls) are statically linked, but not stripped. Does having a dynamically linked binary help with performance?

ptitSeb commented 1 year ago

Having dynamicaly linked libs helps performances only if the lib is wrapped in box64. glad is not wrapped for example, so static link is fine.