04.02.2016, 20:52
Hi,
So first off this is some pretty advanced stuff - rep+ for commanding a mastery of it MakuPL! I think you could probably improve on it in areas - specifically, you could eliminate your defines by bitshifting 1 left by setid (1 << setid) in your methods.
I agree with Pottus on the optimization front however. There are very few occasions where I personally would sacrifice CPU cycles for memory - so few that I can't even think of a scenario off the top of my head. Single threaded as SA-MP is; slow operations directly affect the playability of the server.
Memory, besides aesthetically being a large number (that is still a fraction of a fraction of a modern server's total RAM), is pretty much sidelined.
By its very nature this is many times slower than just directly setting or un-setting a variable - least of all because it has to set and return a new variable anyway.
As always I'd be happy to be proven wrong though.
So first off this is some pretty advanced stuff - rep+ for commanding a mastery of it MakuPL! I think you could probably improve on it in areas - specifically, you could eliminate your defines by bitshifting 1 left by setid (1 << setid) in your methods.
I agree with Pottus on the optimization front however. There are very few occasions where I personally would sacrifice CPU cycles for memory - so few that I can't even think of a scenario off the top of my head. Single threaded as SA-MP is; slow operations directly affect the playability of the server.
Memory, besides aesthetically being a large number (that is still a fraction of a fraction of a modern server's total RAM), is pretty much sidelined.
By its very nature this is many times slower than just directly setting or un-setting a variable - least of all because it has to set and return a new variable anyway.
As always I'd be happy to be proven wrong though.