Speed up code (check_say)

This is the place to make suggestions for Warcraft3 XP.

Moderator: Forum Moderator

User avatar
juKay
WC3Mods Donor
WC3Mods Donor
Posts: 14
Joined: Thu Aug 11, 2005 2:36 am
Location: Härnösand / Sweden
Contact:

Speed up code (check_say)

Postby juKay » Thu Aug 11, 2005 2:56 am

I think you could save alot of CPU cycles if the function check_say were splitted into one function for each thing. Right now you have 12 if that it goes thru ever time someone says something and that is bad in my opinion.

example

Code: Select all

public plugin_init() {
  register_clcmd("say /changerace","change_race_say")
  register_clcmd("team_say /changerace", "change_race_say")
}

public change_race_say (id) {
  change_race(id, 1);
}


I could do it for you if you think this is a good idea and provide you with a .diff

User avatar
ferret
Lead Warcraft 3 XP Developer
Posts: 422
Joined: Wed Jul 06, 2005 8:20 am
Location: Atlanta, GA
Contact:

Postby ferret » Thu Aug 11, 2005 7:52 am

Oh, I know how to do it. It simply hasn't been at the top of my priority list. This bit of code is some of the oldest in the plugin.

On the same note though, you won't truly save MUCH performance by splitting it up. AMXX will just register x more commands which all have to be checked against as a match. But AMXX will do it slightly faster that way and you'll probably see it next release.
-< www.gamehavoc.com >-

Lazarus Long: And I know you didn't because the Server Files are version 2.2.6 and the file you posted is version 2.2.5, so do as I told you above and don't ever lie to me again or help is gone!

User avatar
juKay
WC3Mods Donor
WC3Mods Donor
Posts: 14
Joined: Thu Aug 11, 2005 2:36 am
Location: Härnösand / Sweden
Contact:

Postby juKay » Thu Aug 11, 2005 8:14 am

ferret wrote:Oh, I know how to do it. It simply hasn't been at the top of my priority list. This bit of code is some of the oldest in the plugin.

On the same note though, you won't truly save MUCH performance by splitting it up. AMXX will just register x more commands which all have to be checked against as a match. But AMXX will do it slightly faster that way and you'll probably see it next release.


Yes I know and that was my point with it, better to move it down the chain. I also know that you can do it, just simply wanted to help so you get some time over for other things.

User avatar
Geesu
<b>King of the world!</b>
Posts: 3158
Joined: Tue Jul 05, 2005 9:24 pm
Contact:

Postby Geesu » Thu Aug 11, 2005 10:55 am

12 if statements is not a lot of CPU cycles....
No Support via PM

User avatar
juKay
WC3Mods Donor
WC3Mods Donor
Posts: 14
Joined: Thu Aug 11, 2005 2:36 am
Location: Härnösand / Sweden
Contact:

Postby juKay » Thu Aug 11, 2005 11:36 am

Geesu wrote:12 if statements is not a lot of CPU cycles....


Checked a log and it had 159 say/team_say in it for a 20 minutes time span. That make a totalt of 1908 checks that is not needed. Even if they would be needed they could be executed at a lower level than checking them in a plugin.

Or am I wrong when I assume that register a command like say /command would be faster than doing a check with if/else statements?

User avatar
Lazarus Long
Lead PITA SOB
Posts: 618
Joined: Tue Jul 05, 2005 9:24 pm

Postby Lazarus Long » Tue Sep 13, 2005 8:30 am

done - it will be part of 2.6.2
Lazarus


Return to “WC3XP - Suggestions / Ideas”

Who is online

Users browsing this forum: No registered users and 1 guest