How does Haxe compiled code compare in performance to its different targets?
For example, is PHP coming from Haxe faster or slower than original PHP code?
What about Javascript? Flash? C++? Etc.
Is there any serious benchmark out there?
How does Haxe compiled code compare in performance to its different targets?
For example, is PHP coming from Haxe faster or slower than original PHP code?
What about Javascript? Flash? C++? Etc.
Is there any serious benchmark out there?
I don't know what benchmarks are out there, and it would certainly differ by target platform, so I guess this is only half an answer. But here are some general points:
If you search you can find several benchmarks comparing OpenFL/NME to Flash. One example is this one
For CPP, I am told things are slightly slower than regular C++. I imagine hand-optimised C++ could get quite a bit faster. An example benchmark from the creator of HXCPP here
For JS, I know Haxe sticks to relative best practices for performance. For example, the strictly typed nature of Haxe tends to result in the best performance with Javascript JIT compilers, so Haxe code is fairly comparable to well-written Javascript. (Note, I'm talking about regular JS here, not canvas / openFL graphics stuff - obviously that would require your own benchmarks).
For PHP, I'm not sure how Haxe generated PHP compares to hand written PHP. What I can tell you is that you can almost seamlessly switch from PHP to Neko (both run on apache easily) and you will get code much faster than hand-written PHP. Your bottle necks will come from DB access etc, not the code execution.
For flash, search around and you will probably find benchmarks. Haxe gives you some compile time features such as generics, type-safety and function inlining, which can help runtime performance.
Overall
The biggest performance gain with Haxe isn't from comparing it to the hand-written code in the same language, it's from being able to switch to a faster platform without much effort. Write in PHP, switch to neko -> huge speedup. Write in Flash, switch to OpenFL (C++) -> huge speedup.
Hopefully someone else can post some links to more relevant benchmarks :)
mod_neko
easily on Apache? Because wherever I look, this does not seems to be straightforward. –
Rodmann mod_neko2.ndll
file, but you need to add the apache config yourself. I used these two pages to help me: haxe.org/doc/build/mod_neko and haxe.org/doc/build/mod_neko/jan_cheatsheet ... If you still have trouble ask on the Haxe mailing list and I'll try to write some clearer instructions for you there. Good luck! Once apache's configured it's fairly trivial to switch from using Haxe/PHP to Haxe/Neko. –
Nopar You can look to this article. It compares the Haxe compilers. PHP seems to be the slowest among 5 target compilers. https://hal.inria.fr/hal-01356849/document
© 2022 - 2024 — McMap. All rights reserved.