Command flags
#1

Having flags in command processors is great.
Before Pawn.CMD's release, I used to create admin commands using a special macro that checks for the admin level.
Pawn.CMD (And SmartCMD now) made it simpler by adding bit flags to any command.

But I was wondering, isn't it (more optimized)/faster to do the admin if-checks (for example), in admin commands only,
instead of checking the flags of every command that is processed?
Reply
#2

Firstly, the upgrade/downgrade is negligible.
Secondly, it makes your code tidier.

By doing the check in OnPlayerCommandReceived callback, you avoid the command function call and also the OnPlayerCommandPerformed function call. You are saving two function calls.

Whatever the change in performance may be, it is so negligible that you won't even save 1ms after running the server for a whole day.
Reply
#3

Quote:
Originally Posted by Yashas
View Post
Firstly, the upgrade/downgrade is negligible.
Secondly, it makes your code tidier.

By doing the check in OnPlayerCommandReceived callback, you avoid the command function call and also the OnPlayerCommandPerformed function call. You are saving two function calls.

Whatever the change in performance may be, it is so negligible that you won't even save 1ms after running the server for a whole day.
Okay, thanks!
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)