kostya / benchmarks

Some benchmarks of different languages
MIT License
2.81k stars 255 forks source link

More PHP tests? #453

Open martin-braun opened 1 year ago

martin-braun commented 1 year ago

I found this project, because I want to compare Debian vs Alpine Linux to learn when to use what OS. I would love to have more PHP tests available, i.e. for matmul or primes.

Thank you!

nuald commented 1 year ago

We don't have any immediate plans to add more PHP tests, but all contributions are welcomed. Please let me note though that the general comparison should be not Debian vs Alpine, but rather glibc vs musl libc. Working extensively with both of them, I'd like to share my observations:

From my PoV, the biggest advantage of musl is providing ability to build fully statically linked executables that is handy for the embedded or easy-to-deploy development. And, unfortunately, benchmarks could barely help here (or you need the specific benchmarks, like testing memory operations speed).

martin-braun commented 1 year ago

Hello @nuald, first of all thanks for the quick response. Yes this is all about glibc vs musl libc, not Debian vs. Alpine, and I very much appreciate your shared insights.

Yes, comparison between binaries can show how much musl can improve the performance, but I'm interested how poor musl will perform when it comes to interpreted code. Afaik compilation with musl is slower and there are rumors that PHP performs worse since version 8, since they improved the JIT module. I'm not sure this had to do with memory allocations or whatever, my simple goal is to benchmark a lot of stuff to get a broader picture.

Unfortunately, most PHP scripts require to hook-up a web server. While this is good to test real life scenarios, I want to get pure PHP metrics, instead.

I'm interested in musl, not just because of usage in embedded systems, but also for use on lightweight linux containers. This is also why I don't run the docker container, instead, I hooked up an LXC container and installed all required dependencies via APK.

So long story short, I'd like to test interpreters with various languages and code samples with glibc and musl to get a good overall picture about what musl can do well and what musl cannot do well.

For instance, the python base64 test has shown that the encoding took slightly less time on musl, while the decoding took twice as much time on musl, which was interesting and revealing to me.