wc3campaigns
WC3C Homepage - www.wc3c.netUser Control Panel (Requires Log-In)Engage in discussions with other users and join contests in the WC3C forums!Read one of our many tutorials, ranging in difficulty from beginner to advanced!Show off your artistic talents in the WC3C Gallery!Download quality models, textures, spells (vJASS/JASS), systems, and scripts!Download maps that have passed through our rigorous approval process!

Go Back   Wc3C.net > Resources > Code Resources > Scripts
User Name
Password
Register Rules Get Hosted! Chat Pastebin FAQ and Rules Members List Calendar



Reply
 
Thread Tools Search this Thread
Old 02-09-2009, 06:08 PM   #31
azwraith_ftL
User
 
azwraith_ftL's Avatar
 
Join Date: May 2008
Posts: 38

azwraith_ftL has little to show at this moment (4)

Default

Just to clarify, GroupRefresh() should be used before FirstOfGroup() loop after some amount of time has passed with the new group and thus prevent incorrect comparission?
__________________
Also known as cr4xzZz at TheHelper.net.
azwraith_ftL is offline   Reply With Quote
Sponsored Links - Login to hide this ad!
Old 02-09-2009, 08:46 PM   #32
emjlr3
Rehabbing
 
emjlr3's Avatar
 
Join Date: Jun 2005
Posts: 1,386

Submissions (14)

emjlr3 is a jewel in the rough (151)emjlr3 is a jewel in the rough (151)

Mapping Contest First Place

Send a message via AIM to emjlr3 Send a message via MSN to emjlr3
Default

well a group refresh would not be needed if you are using the firstofgroup method on your group, since you're probably removing the units in that fashion anyway (and i doubt its been sitting around doing nothing for a while - as in you filled it a while ago and are just not deciding to use it) - you would really only need it before a ForGroup

but yea, if you filled the group a while back, and are now down the road somewhere deciding to run a firstofgroup loop through it, a grouprefresh would save some overhead
__________________

Last edited by emjlr3 : 02-09-2009 at 08:47 PM.
emjlr3 is offline   Reply With Quote
Old 02-09-2009, 10:35 PM   #33
Anitarf
Procrastination Incarnate


Development Director
 
Join Date: Feb 2004
Posts: 8,189

Submissions (19)

Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)

2008 Spell olympics - Fire - SilverApproved Map: Old School Alliance TacticsHero Contest #2 - 3rd PlaceSpell making session 2 winner

Default

Quote:
but yea, if you filled the group a while back, and are now down the road somewhere deciding to run a firstofgroup loop through it, a grouprefresh would save some overhead
Not just save some overhead, but prevent critical bugs. Without calling RefreshGroup, FirstOfGroup could return null before the group was empty.
__________________
Anitarf is offline   Reply With Quote
Old 03-02-2009, 05:20 AM   #34
midiway
Pro-carnivorous
 
midiway's Avatar
 
Join Date: Nov 2006
Posts: 217

Submissions (1)

midiway will become famous soon enough (43)midiway will become famous soon enough (43)

Default

Shouldn't ENUM_GROUP be a constant global?
midiway is offline   Reply With Quote
Old 03-02-2009, 06:44 AM   #35
Bobo_The_Kodo
oO
 
Bobo_The_Kodo's Avatar
 
Join Date: Jul 2008
Posts: 580

Bobo_The_Kodo has a spectacular aura about (109)Bobo_The_Kodo has a spectacular aura about (109)Bobo_The_Kodo has a spectacular aura about (109)Bobo_The_Kodo has a spectacular aura about (109)

Default

It would then probably be inlined as CreateGroup() everywhere, no?
Bobo_The_Kodo is offline   Reply With Quote
Old 03-02-2009, 11:16 AM   #36
Captain Griffen
Dread Lord of the Cookies
 
Captain Griffen's Avatar


Content Director
 
Join Date: Sep 2003
Posts: 5,375

Submissions (2)

Captain Griffen is a glorious beacon of light (497)Captain Griffen is a glorious beacon of light (497)Captain Griffen is a glorious beacon of light (497)Captain Griffen is a glorious beacon of light (497)Captain Griffen is a glorious beacon of light (497)

Approved Map: Warlords[Quicksilver #2] - 1st Place

Default

Shouldn't be inlined (that'd be a bug in the inliner), but constant handle variables are simply pointless. Utterly so.
__________________
Quote:
Originally Posted by Earth-Fury
Griffen is correct, you are not.
Quote:
[13:32] <Akolyt0r> hmm.. stil i want to have some unused women
Captain Griffen is offline   Reply With Quote
Old 04-08-2009, 02:36 AM   #37
Anitarf
Procrastination Incarnate


Development Director
 
Join Date: Feb 2004
Posts: 8,189

Submissions (19)

Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)

2008 Spell olympics - Fire - SilverApproved Map: Old School Alliance TacticsHero Contest #2 - 3rd PlaceSpell making session 2 winner

Default

A thought: why shouldn't the users be allowed to call ReleaseGroup on groups created with CreateGroup instead of NewGroup? Seems to me like the script would work just fine either way.
__________________
Anitarf is offline   Reply With Quote
Old 04-08-2009, 03:00 AM   #38
Rising_Dusk
Obscurity, the Art


Projects Director
Project Leader: OD
 
Join Date: Feb 2006
Posts: 9,729

Submissions (27)

Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)

Hero Contest #3 - 1st PlaceApproved Map: Desert of ExileApproved Map: Advent of the ZenithHero Contest #2 - 1st PlaceHero Contest - Third place>

Send a message via AIM to Rising_Dusk Send a message via MSN to Rising_Dusk
Default

I suppose you're right. I just don't like the idea of outside groups being 'loaded' to the stack. It isn't a problem, though, so I could remove the check.
__________________
Rising_Dusk is offline   Reply With Quote
Old 04-13-2009, 11:01 PM   #39
Troll-Brain
User
 
Join Date: Oct 2006
Posts: 1,490

Submissions (1)

Troll-Brain has a spectacular aura about (134)

Default

ENUM_GROUP and GroupRefresh are useful, but i don't understand why NewGroup and ReleaseGroup are.

Just because you don't need to null a variable group with NewGroup when you release it ?

Last edited by Troll-Brain : 04-13-2009 at 11:01 PM.
Troll-Brain is offline   Reply With Quote
Old 04-13-2009, 11:17 PM   #40
Rising_Dusk
Obscurity, the Art


Projects Director
Project Leader: OD
 
Join Date: Feb 2006
Posts: 9,729

Submissions (27)

Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)

Hero Contest #3 - 1st PlaceApproved Map: Desert of ExileApproved Map: Advent of the ZenithHero Contest #2 - 1st PlaceHero Contest - Third place>

Send a message via AIM to Rising_Dusk Send a message via MSN to Rising_Dusk
Default

Because it is senseless to create and destroy handles when you can recycle them perfectly.
Quote:
Originally Posted by Troll-Brain
Just because you don't need to null a variable group with NewGroup when you release it ?
This is also true.
__________________
Rising_Dusk is offline   Reply With Quote
Old 04-13-2009, 11:37 PM   #41
Anitarf
Procrastination Incarnate


Development Director
 
Join Date: Feb 2004
Posts: 8,189

Submissions (19)

Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)

2008 Spell olympics - Fire - SilverApproved Map: Old School Alliance TacticsHero Contest #2 - 3rd PlaceSpell making session 2 winner

Default

Quote:
Originally Posted by Troll-Brain
ENUM_GROUP and GroupRefresh are useful, but i don't understand why NewGroup and ReleaseGroup are.
Creating and destroying handles is slow and in the case of groups it also causes memory leaks. That is why, like with timers, we have good reasons to recycle them.
__________________
Anitarf is offline   Reply With Quote
Old 04-14-2009, 04:13 PM   #42
Troll-Brain
User
 
Join Date: Oct 2006
Posts: 1,490

Submissions (1)

Troll-Brain has a spectacular aura about (134)

Default

Creating / destroying an handle is slower that calling several functions (extended array, bug return, and so one ...) to recycle them ?

I thought you did it with timers because of the potential bug destroy + null.

Anyway i think i've an other reason to recycle group, no need to care about ghost units inside it when you release it, no ?

Last edited by Troll-Brain : 04-14-2009 at 04:14 PM.
Troll-Brain is offline   Reply With Quote
Old 04-14-2009, 06:11 PM   #43
Rising_Dusk
Obscurity, the Art


Projects Director
Project Leader: OD
 
Join Date: Feb 2006
Posts: 9,729

Submissions (27)

Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)

Hero Contest #3 - 1st PlaceApproved Map: Desert of ExileApproved Map: Advent of the ZenithHero Contest #2 - 1st PlaceHero Contest - Third place>

Send a message via AIM to Rising_Dusk Send a message via MSN to Rising_Dusk
Default

Speedwise, it is probably even or so. Benchmark it if you really care. Anyways, even if there isn't a great reason to recycle groups instead of creating/destroying them, it is good practice to recycle your handles.
Quote:
Originally Posted by Troll-Brain
I thought you did it with timers because of the potential bug destroy + null.
This was a pleasant side-effect of good coding practice.
__________________
Rising_Dusk is offline   Reply With Quote
Old 04-14-2009, 06:16 PM   #44
Troll-Brain
User
 
Join Date: Oct 2006
Posts: 1,490

Submissions (1)

Troll-Brain has a spectacular aura about (134)

Default

I just want to know why, i'm not so stupid, i know there are reasons to approved that, i simply try to know all of them.
Maybe i'm wrong but i really doubt you win efficient, even if it's not the point, and i've understood that.

It would be cool if someone could tell me if it's faster or slower and how much, just to know.

Quote:
This was a pleasant side-effect of good coding practice.
You mean it can't be happen, until you code badly, so in an other word it's an "user bug" ?
Troll-Brain is offline   Reply With Quote
Old 04-14-2009, 06:22 PM   #45
Rising_Dusk
Obscurity, the Art


Projects Director
Project Leader: OD
 
Join Date: Feb 2006
Posts: 9,729

Submissions (27)

Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)

Hero Contest #3 - 1st PlaceApproved Map: Desert of ExileApproved Map: Advent of the ZenithHero Contest #2 - 1st PlaceHero Contest - Third place>

Send a message via AIM to Rising_Dusk Send a message via MSN to Rising_Dusk
Default

Quote:
Originally Posted by Troll-Brain
I just want to know why, i'm not so stupid, i know there are reasons to approved that, i simply try to know all of them.
Maybe i'm wrong but i really doubt you win efficient, even if it's not the point, and i've understood that.
I didn't say you were stupid. I really think that it is just the good practice of it. We are past destroying handles that do not need to be destroyed, even if on a marginal microsecond basis it is faster.
Quote:
Originally Posted by Troll-Brain
It would be cool if someone could tell me if it's faster or slower and how much, just to know.
I doubt anyone has actually tested, which is why I suggested to you to perform the benchmarks.
Quote:
Originally Posted by Troll-Brain
You mean it can't be happen, until you code badly, so in an other word it's an "user bug" ?
No. I mean that the timer-null bug was not the reason timer stacks were invented. They were invented because it is smarter to not be destroying handles, because it is good practice, and because we no longer have to worry about gorging the handle stack. That they fixed the timer-null bug was a pleasant side-effect.
__________________
Rising_Dusk is offline   Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off


All times are GMT. The time now is 02:53 PM.


Affiliates
The Hubb The JASS Vault Clan WEnW Campaign Creations Clan CBS GamesModding Flixreel Videos

Powered by vBulletin (Copyright ©2000 - 2018, Jelsoft Enterprises Ltd).
Hosted by www.OICcam.com
IT Support and Services provided by Executive IT Services