I come to you today with a query: which scripting language is best when it comes to performance and managing larger-scale projects? Lua, JavaScript, and C# each has their own strengths and weaknesses.
Performance Comparison:
I aim to delve into both the performance metrics and the structural capabilities of these languages, with a focus on their suitability for handling sizable projects. While browsing through older posts on this forum, I found insights suggesting that C# tends to exhibit a lower CPU msec in resource monitoring compared to Lua, which in turn surpasses JavaScript. However, these observations might have evolved over time.
Project Structuring:
Therefore, I urge our esteemed community members to share their recent experiences and observations regarding these scripting languages. Have there been significant advancements or shifts in performance benchmarks since the older posts? How do Lua, JavaScript, and C# fare when it comes to maintaining codebase integrity and scalability in contemporary development scenarios?
Even though this is clearly AI-written (seriously?!), I will look past that and answer some of your concerns.
Lua is generally the most optimal choice for making code-related resources on FiveM; it’s scalable, very easy to work with even for a beginner to coding, and pretty simple to understand. JS (short for JavaScript) is only really used for UI logic and shouldn’t be used to make “actual code”. Lastly, C# is about on par with Lua in regards to performance - better in some situations and worse in others - but it’s harder to work it, being a compiler language.
TLDR: Use Lua for script logic, JS for UI logic, and C# if you need to / want to learn it for some reason.
Lua is the most optimal choice, this is a fact, you will likely see a lot of projects using Lua, its fast enough, simple, and non-typed.
JS (mostly TS) has been gaining popularity because being able to type your code is generally important, it has the general downside that it is a lot slower in native execution than the other two runtimes and has a very minuscule tick overhead that some can’t see past.
C# is generally “the game developer language”, and with mono rt2 being closer to release, it will likely be the best choice for performance, code structure, and enforced types, if you’re using TypeScript already it will likely be an easy conversion.
I’m not sure where Lua has better perf then C# in any regard either, while Lua beats JS handily, it still loses to C# rt2.
Some performance stats
At the end of the day, use whatever runtime you want that fits your needs because they’re all good enough