Re: [TUT] SourcePawn Scripting - Tips, Basics to Advanced
strcopy has less logic, should be faster.
Also, if you need stringbuilder functionality, use strCat; it doesn't re-create string buffer unlike Format. |
Re: [TUT] SourcePawn Scripting - Tips, Basics to Advanced
Thank you very much,
the various "handle.method" of the new syntax seems to be just the wrapper of the old syntax, is there a difference in their speed? Such as "ClearArray (ArrayList)" and "ArrayList.Clear()", etc. |
Re: [TUT] SourcePawn Scripting - Tips, Basics to Advanced
You can use either-or. The speed is irrelevant. It’s more a matter of preference rather than which one is slightly faster.
If you’re really curious about it, you can use the profiler. Pre-optimizing your plugin is a waste of time. Unless you’re actually experiencing performance issues with your plugin, don’t worry so much about choosing the fastest method/function for every part of your code. You may end up sacrificing readability, maintainability, and simplicity for a negligible difference in speed. Optimizing Plugins (SourceMod Scripting) |
Re: [TUT] SourcePawn Scripting - Tips, Basics to Advanced
For something like this optimizing is negligible but I wouldn't advise against optimizing especially if the plugin will be made publicly available. Many public ones have huge performance hits due to bad practices and some servers running many plugins will feel the degradation in performance due to certain unoptimized plugins.
|
Re: [TUT] SourcePawn Scripting - Tips, Basics to Advanced
I have a question: int i[N][33] or ArrayList i[33] Which is better? The before cause too many plugin file size after compiled
|
Re: [TUT] SourcePawn Scripting - Tips, Basics to Advanced
"Which is better" most of the time depends on the situation and the use case.
You should share an example and mention the "before" and "after" sizes as well. |
Re: [TUT] SourcePawn Scripting - Tips, Basics to Advanced
Quote:
PHP Code:
PHP Code:
|
Re: [TUT] SourcePawn Scripting - Tips, Basics to Advanced
Should be: MAXPLAYERS+1 not just MAXPLAYERS
|
Re: [TUT] SourcePawn Scripting - Tips, Basics to Advanced
iaNanaNana, you don't need array of lists, it is already an "array" of blocks.
Also, alloc/release handles is a heavy operation. See: PHP Code:
PHP Code:
|
Re: [TUT] SourcePawn Scripting - Tips, Basics to Advanced
I would like to ask, how to calculate the number of bytes occupied by the string in IntToString, FloatToString
|
| All times are GMT -4. The time now is 22:27. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.