[How-To] Run Scripts on Crack (Multi-threading)

Incorrect. Yes, at this time, as an implementation detail, it is the case that exports use an event to get the callback on first use, but other than that exports directly route to the target resource, allow returning data (and promises), and are obviously the right choice for unicast calls as opposed to an event which will route to just about anything as an extreme waste.

1 Like

Okay so if I understand correctly, proper usage of events over exports would be, a resource would trigger an event that multiple other resources need to handle, like an onDeath event being triggered so 5-6 other resources can handle it, and you would export a function that one resource needs to handle from multiple other resources calling it, like an addStatusValue function that 3-4 other resources would call. Also, exports are more useful for function calls as such, due to the export directly calling the function code, rather than triggering something expecting a listener?

I’m currently observing the changes and updates made for people who chose to go with C#. I haven’t properly looked into fiveM server, but I’m assuming that anything .net can be used, including SIMD-optimized functions available in .net? If that’s the case, that changes everything and C# would clearly be superior. Some loops can be “parallelized” if the same operation is done on multiple players for example.

break

Ok, I have to ask, because I can’t find shit in the cfx/lua, GLM, or fkkn anything repo’s…

Where the hell does string.strjoin come from? Or more specifically, as your use in ox_lib sent me down this rabbit hole, where the hell does string.tostringall() come from?

I’ve done some testing and can make some reasonable assumptions to how they work, but I can’t find source for them bloody anywhere!

Real confused why you’re posting this here – but fortunate for you I have this thread followed I guess.

Hey, so sorry if this is a bit off topic, but shortly after we had this discussion I noticed that FiveM was using my cores more evenly and was using far more CPU, however I noticed no increase in performance. I’m wondering if maybe one of the Elements gave in to the pressure from end-users complaining about multi-threading despite knowing, as you explained, that it’s against our best interest.

I’m asking because I’m currently looking into performance issues regarding a mysterious idle load and I’m trying to figure out if the increased usage of previously idle cores is due to the lock contention and whatnot that you mentioned or if it’s related to the phenomenon that I’m chasing after. I’ve currently got a post on the subject in client support awaiting approval, I’ll try to link it here later.