Re: [Pharo-dev] opal optimize to do limits

2015-11-21 Thread Levente Uzonyi
On Fri, 20 Nov 2015, Clément Bera wrote: You can use whileTrue: if it's a problem for you not to evaluate the limit at each iteration of the loop. If you look at OrderedCollection for example, there are implemented differently in Pharo/VW and Squeak. Pharo and VW use to:do: whereas Squeak uses

Re: [Pharo-dev] opal optimize to do limits

2015-11-21 Thread Eliot Miranda
Hi Nicolai, On Sat, Nov 21, 2015 at 10:40 AM, Nicolai Hess wrote: > > > 2015-11-20 9:58 GMT+01:00 Eliot Miranda : > >> Hi Nicolai, >> >> On Nov 20, 2015, at 12:33 AM, Nicolai Hess wrote: >> >> Thanks eliot, Clement, >> >> but if the argument for to:do: is not an expression but one of the method

Re: [Pharo-dev] opal optimize to do limits

2015-11-21 Thread Nicolai Hess
2015-11-20 9:58 GMT+01:00 Eliot Miranda : > Hi Nicolai, > > On Nov 20, 2015, at 12:33 AM, Nicolai Hess wrote: > > Thanks eliot, Clement, > > but if the argument for to:do: is not an expression but one of the method > argument, this > transformation is not needed. Or still? > > > That's the coroll

Re: [Pharo-dev] opal optimize to do limits

2015-11-20 Thread Eliot Miranda
Hi Nicolai, > On Nov 20, 2015, at 12:33 AM, Nicolai Hess wrote: > > Thanks eliot, Clement, > > but if the argument for to:do: is not an expression but one of the method > argument, this > transformation is not needed. Or still? That's the corollary to what I said. Since method (*) arguments

Re: [Pharo-dev] opal optimize to do limits

2015-11-20 Thread Nicolai Hess
Thanks eliot, Clement, but if the argument for to:do: is not an expression but one of the method argument, this transformation is not needed. Or still? 2015-11-20 8:31 GMT+01:00 Clément Bera : > You can use whileTrue: if it's a problem for you not to evaluate the limit > at each iteration of

Re: [Pharo-dev] opal optimize to do limits

2015-11-19 Thread Clément Bera
You can use whileTrue: if it's a problem for you not to evaluate the limit at each iteration of the loop. If you look at OrderedCollection for example, there are implemented differently in Pharo/VW and Squeak. Pharo and VW use to:do: whereas Squeak uses whileTrue: to iterate over the collection. H

Re: [Pharo-dev] opal optimize to do limits

2015-11-19 Thread Eliot Miranda
Because were to:do: not inlined the expression passed as the to: actual argument would be evaluated exactly once (bound to the formal argument for to:) and so assigning to a temporary preserves the semantics in the most direct way. If the expression has side effects then those side effects must

Re: [Pharo-dev] opal optimize to do limits

2015-11-19 Thread Nicolai Hess
2015-11-19 22:29 GMT+01:00 stepharo : > SSA form? > > and for method arguments? foo: count | sum | sum := 0. 1 to: count do: [ :ku | sum := sum + ku ]. ^ sum transforms to: "foo: arg1 | tmp1 tmp2 | tmp1 := 0. tmp2 := arg1. 1 to: tmp2 do: [ :tmp3 | tmp1 := tmp1 +

Re: [Pharo-dev] opal optimize to do limits

2015-11-19 Thread stepharo
SSA form? Le 19/11/15 22:14, Nicolai Hess a écrit : What is the purpose of replacing expressions, used as limits in a to:do: call with by a new temporary variable? For example: OCOpalExamples>>#exampleToDoArgumentLimitIsExpression the code is exampleToDoArgumentLimitIsExpression | count s

[Pharo-dev] opal optimize to do limits

2015-11-19 Thread Nicolai Hess
What is the purpose of replacing expressions, used as limits in a to:do: call with by a new temporary variable? For example: OCOpalExamples>>#exampleToDoArgumentLimitIsExpression the code is exampleToDoArgumentLimitIsExpression | count sum | count := 10. sum := 0. 1 to: count - 1