Title: [UNDER CONSIDERATION] Use Array.slice(0) to copy Observers instead of a loop Post by: Tekool on February 19, 2011, 06:07:06 Here is the code used in View.notifyObservers() method to copy the Array we will loop over to notify observers :
public function notifyObservers( notification:INotification ) : void This take a lot of CPU steps for nothing and as this method is heavily used, I think we can benefit a lot from changing it to: public function notifyObservers( notification:INotification ) : void Title: Re: Use Array.slice(0) to copy the Array in View.notifyObservers instead of a loop Post by: puremvc on February 20, 2011, 01:33:31 Another place where we need to know how many cycles difference we're talking about before the 'pro' side of the argument has definite weight.
On the 'con' side is that we're trying to use the simplest possible language constructs wherever possible. If it isn't outrageously unperformant, then it is better to use constructs that are available in the widest possible number of languages. Array.slice() or (a handy analog thereof) may not be available in all languages, thus the porting developer needs to come up with a solution in their language. -=Cliff> Title: Re: [SUGGESSTION] Use Array.slice(0) to copy Observers instead of a loop Post by: Tekool on February 20, 2011, 03:55:24 To have worked on near each language PureMVC was ported I saw that each developer chosen to use the more appropriate solution for the language on which PureMVC was ported. When it has no consequence on the behavior of PureMVC nor its implementation, I think this is good to benefits from possible optimization provided by a specific language. This one is really important as it adds twice the unwanted debug steps located in notifyObservers methods when working in debug mode.
|