Selectors as variables?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
58 messages Options
123
Reply | Threaded
Open this post in threaded view
|

Re[2]: Selectors as variables?

Michael Lucas-Smith

> Bruce,

> How would you do SUnit without perform:?

With Pragmas.

>  
> --
> Travis Griggs
> Objologist
> "You A students, you'll be back soon teaching here with me. You B
> students, you'll actually go on to be real engineers. You C
> students, you'll go into management and tell the A and B students
> what to do." - My Fluid Dynamics Professor whom I have yet to disprove

>  



Reply | Threaded
Open this post in threaded view
|

RE: Re[2]: Selectors as variables?

Boris Popov, DeepCove Labs (SNN)
You'd still need to invoke code somehow :)

-Boris

--
+1.604.689.0322
DeepCove Labs Ltd.
4th floor 595 Howe Street
Vancouver, Canada V6C 2T5
http://tinyurl.com/r7uw4

[hidden email]

CONFIDENTIALITY NOTICE

This email is intended only for the persons named in the message
header. Unless otherwise indicated, it contains information that is
private and confidential. If you have received it in error, please
notify the sender and delete the entire message including any
attachments.

Thank you.

> -----Original Message-----
> From: Michael Lucas-Smith [mailto:michael.lucas-
> [hidden email]]
> Sent: Tuesday, March 20, 2007 1:35 PM
> To: Travis Griggs
> Cc: vwnc
> Subject: Re[2]: Selectors as variables?
>
>
> > Bruce,
>
> > How would you do SUnit without perform:?
>
> With Pragmas.
>
> >
> > --
> > Travis Griggs
> > Objologist
> > "You A students, you'll be back soon teaching here with me. You B
> > students, you'll actually go on to be real engineers. You C
> > students, you'll go into management and tell the A and B students
> > what to do." - My Fluid Dynamics Professor whom I have yet to
disprove
>
> >
>
>

Reply | Threaded
Open this post in threaded view
|

Re[4]: Selectors as variables?

Michael Lucas-Smith
You can call #valueWithReceiver:arguments: on the actual compiled
method that contained the pragma, thus avoiding a perform:.

Is it clearer or any easier? .. nah, it's probably about the same.

> You'd still need to invoke code somehow :)

> -Boris


Reply | Threaded
Open this post in threaded view
|

Re: Selectors as variables?

Travis Griggs-3
In reply to this post by Bruce Badger
On Mar 20, 2007, at 13:09, Bruce Badger wrote:

On 20/03/07, Travis Griggs <[hidden email]> wrote:

How would you do SUnit without perform:?

Good point!  Thank goodness I never say never! :-)

Travis, I do I like Boris's latest response to you and agree with the
distinction he makes.  I think his thoughts on this are more refined
than mine. I shall steal them forthwith.

Well, this is quite a refinement. Especially, since the original poster did not make it clear that he was actually doing something like what Boris opposed. For all we know, he was making an inspector, where the selectors of a given protocol we're queried and then passed to this method to be executed with additional behavior around them (there's another example: everytime you "dive" in trippy...).

Perhaps we can give this topic a more extensive flogging at StS07?

Yes please. Let's do it right after the yearly STIC meeting. :)

So here's an example of a place I used them once upon a time. I used them for a small stateMachine. Where each state transition was encoded as as a message send of #currentState_nextState and performed. It worked remarkably well. And was much easier to deal with the former version that went overboard trying to make an object for each state. Much easier to write unit tests for.

I put forward the use of perform'ed symbols for the character scanners. You've got me wondering if now if these tables wouldn't be better of as tables of blocks. Since a block invokation is faster than a symbol perform and that's a speed critical area.

And as you noted earlier... just about any sort of "serialization" mechanism is *easier* to do with perform:ed Symbols (though Blocks are not impossible).

--
Travis Griggs
Objologist
"Is success the potential of what could be, or the reality of what is?"


Reply | Threaded
Open this post in threaded view
|

RE: Selectors as variables?

Boris Popov, DeepCove Labs (SNN)
"I put forward the use of perform'ed symbols for the character scanners.
You've got me wondering if now if these tables wouldn't be better of as
tables of blocks. Since a block invokation is faster than a symbol
perform and that's a speed critical area."

Is it actually faster?

today := Core.Date today.
b := [:date | date year].
Array
  with: (Core.Time millisecondsToRun: [10000000 timesRepeat: [today
perform: #year]])
  with: (Core.Time millisecondsToRun: [10000000 timesRepeat: [b value:
today]])

#(181 288)
#(157 207)
#(183 214)

Cheers!

-Boris

--
+1.604.689.0322
DeepCove Labs Ltd.
4th floor 595 Howe Street
Vancouver, Canada V6C 2T5
http://tinyurl.com/r7uw4

[hidden email]

CONFIDENTIALITY NOTICE

This email is intended only for the persons named in the message
header. Unless otherwise indicated, it contains information that is
private and confidential. If you have received it in error, please
notify the sender and delete the entire message including any
attachments.

Thank you.

> -----Original Message-----
> From: Travis Griggs [mailto:[hidden email]]
> Sent: Tuesday, March 20, 2007 2:11 PM
> To: vwnc
> Subject: Re: Selectors as variables?
>
> On Mar 20, 2007, at 13:09, Bruce Badger wrote:
>
>
> On 20/03/07, Travis Griggs <[hidden email]> wrote:
>
>
> How would you do SUnit without perform:?
>
>
> Good point!  Thank goodness I never say never! :-)
>
> Travis, I do I like Boris's latest response to you and agree
with
> the
> distinction he makes.  I think his thoughts on this are more
refined
> than mine. I shall steal them forthwith.
>
>
> Well, this is quite a refinement. Especially, since the original
poster
> did not make it clear that he was actually doing something like what
Boris
> opposed. For all we know, he was making an inspector, where the
selectors
> of a given protocol we're queried and then passed to this method to be
> executed with additional behavior around them (there's another
example:
> everytime you "dive" in trippy...).
>
>
> Perhaps we can give this topic a more extensive flogging at
StS07?
>
>
> Yes please. Let's do it right after the yearly STIC meeting. :)
>
> So here's an example of a place I used them once upon a time. I used
them
> for a small stateMachine. Where each state transition was encoded as
as a
> message send of #currentState_nextState and performed. It worked
> remarkably well. And was much easier to deal with the former version
that
> went overboard trying to make an object for each state. Much easier to
> write unit tests for.
>
> I put forward the use of perform'ed symbols for the character
scanners.
> You've got me wondering if now if these tables wouldn't be better of
as
> tables of blocks. Since a block invokation is faster than a symbol
perform
> and that's a speed critical area.
>
> And as you noted earlier... just about any sort of "serialization"
> mechanism is *easier* to do with perform:ed Symbols (though Blocks are
not
> impossible).
>
> --
> Travis Griggs
> Objologist
> "Is success the potential of what could be, or the reality of what
is?"
>

Reply | Threaded
Open this post in threaded view
|

Re: Selectors as variables?

Travis Griggs-3

On Mar 20, 2007, at 14:16, Boris Popov wrote:

"I put forward the use of perform'ed symbols for the character scanners.
You've got me wondering if now if these tables wouldn't be better of as
tables of blocks. Since a block invokation is faster than a symbol
perform and that's a speed critical area."

Is it actually faster?

today := Core.Date today.
b := [:date | date year].
Array
  with: (Core.Time millisecondsToRun: [10000000 timesRepeat: [today
perform: #year]])
  with: (Core.Time millisecondsToRun: [10000000 timesRepeat: [b value:
today]])

Welll.... uh... duh. :)

I ASSumed that since the Symbol>>value: trick is about 60% as fast as the single arg block in an enumeration, that... On my machine, I ran 10x the iterations and reduced it to yourself sends. It's a wash on this box. But yes, there is no reason to use the blocks instead of a perform:'ed symbol. And I would argue that since there's no speed gain, the symbol dispatch table is far more concise then initializing it with blocks. Thanks for validating the original example. :)

--
Travis Griggs
Objologist
What's next, Intel Processors branded with "Apple Outside" stickers?


Reply | Threaded
Open this post in threaded view
|

R: Selectors as variables?

Giorgio Ferraris

Hi,

VW741

Version Id:

            #[60 41 60 64 74 1 0 0 60 41 60 64]

Windows xp sp2,

Pentium M 2.13.mhz

 

My result are:

 

#(363 304)

#(416 313)

#(351 314)

 

Much slower (so, what  cpu are you testing on?) and… perform slower than block!!!!

 

What happens?

 

Ciao

 

Giorgio

 


Da: Travis Griggs [mailto:[hidden email]]
Inviato: mercoledì 21 marzo 2007 0.00
A: vwnc
Oggetto: Re: Selectors as variables?

 

 

On Mar 20, 2007, at 14:16, Boris Popov wrote:



"I put forward the use of perform'ed symbols for the character scanners.

You've got me wondering if now if these tables wouldn't be better of as

tables of blocks. Since a block invokation is faster than a symbol

perform and that's a speed critical area."

 

Is it actually faster?

 

today := Core.Date today.

b := [:date | date year].

Array

  with: (Core.Time millisecondsToRun: [10000000 timesRepeat: [today

perform: #year]])

  with: (Core.Time millisecondsToRun: [10000000 timesRepeat: [b value:

today]])

 

Welll.... uh... duh. :)

 

I ASSumed that since the Symbol>>value: trick is about 60% as fast as the single arg block in an enumeration, that... On my machine, I ran 10x the iterations and reduced it to yourself sends. It's a wash on this box. But yes, there is no reason to use the blocks instead of a perform:'ed symbol. And I would argue that since there's no speed gain, the symbol dispatch table is far more concise then initializing it with blocks. Thanks for validating the original example. :)

 

--

Travis Griggs

Objologist

What's next, Intel Processors branded with "Apple Outside" stickers?



 


--
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.5.446 / Virus Database: 268.18.13/726 - Release Date: 18/03/2007 15.34


--
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.5.446 / Virus Database: 268.18.15/728 - Release Date: 20/03/2007 8.07

Reply | Threaded
Open this post in threaded view
|

Re: R: Selectors as variables?

Travis Griggs-3
On Mar 21, 2007, at 11:19, Giorgio Ferraris wrote:

Hi,

VW741

Version Id:

            #[60 41 60 64 74 1 0 0 60 41 60 64]

Windows xp sp2,

Pentium M 2.13.mhz

 

My result are:

 

#(363 304)

#(416 313)

#(351 314)

 

Much slower (so, what  cpu are you testing on?) and… perform slower than block!!!

Giorgio,

What's what there? Which is block and which is perform? I always try to get up into 1000's of milliseconds to wash out "noise". My test was on a G4.

--
Travis Griggs
Objologist
10 2 letter words: "If it is to be, it is up to me"


Reply | Threaded
Open this post in threaded view
|

RE: Selectors as variables?

Björn Eiderbäck-3
In reply to this post by Giorgio Ferraris

I made the following change

Array

  with: (Core.Time millisecondsToRun: [10000000 timesRepeat: [today

perform: #year]])

  with: (Core.Time millisecondsToRun: [10000000 timesRepeat: [b value:

today]])

  with: (Core.Time millisecondsToRun: [10000000 timesRepeat: [ [:date | date year] value:

today]])

 

i.e. added the last test where b is inlined.

And got the following results from three runs:

#(381 620 438)

#(380 632 452)

#(383 627 457)

 

From: Giorgio Ferraris [mailto:[hidden email]]
Sent: den 21 mars 2007 19:19
To: 'Travis Griggs'; 'vwnc'
Subject: R: Selectors as variables?

 

Hi,

VW741

Version Id:

            #[60 41 60 64 74 1 0 0 60 41 60 64]

Windows xp sp2,

Pentium M 2.13.mhz

 

My result are:

 

#(363 304)

#(416 313)

#(351 314)

 

Much slower (so, what  cpu are you testing on?) and… perform slower than block!!!!

 

What happens?

 

Ciao

 

Giorgio

 


Da: Travis Griggs [mailto:[hidden email]]
Inviato: mercoledì 21 marzo 2007 0.00
A: vwnc
Oggetto: Re: Selectors as variables?

 

 

On Mar 20, 2007, at 14:16, Boris Popov wrote:

 

"I put forward the use of perform'ed symbols for the character scanners.

You've got me wondering if now if these tables wouldn't be better of as

tables of blocks. Since a block invokation is faster than a symbol

perform and that's a speed critical area."

 

Is it actually faster?

 

today := Core.Date today.

b := [:date | date year].

Array

  with: (Core.Time millisecondsToRun: [10000000 timesRepeat: [today

perform: #year]])

  with: (Core.Time millisecondsToRun: [10000000 timesRepeat: [b value:

today]])

 

Welll.... uh... duh. :)

 

I ASSumed that since the Symbol>>value: trick is about 60% as fast as the single arg block in an enumeration, that... On my machine, I ran 10x the iterations and reduced it to yourself sends. It's a wash on this box. But yes, there is no reason to use the blocks instead of a perform:'ed symbol. And I would argue that since there's no speed gain, the symbol dispatch table is far more concise then initializing it with blocks. Thanks for validating the original example. :)

 

--

Travis Griggs

Objologist

What's next, Intel Processors branded with "Apple Outside" stickers?

 

 

 

--
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.5.446 / Virus Database: 268.18.13/726 - Release Date: 18/03/2007 15.34

 

--
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.5.446 / Virus Database: 268.18.15/728 - Release Date: 20/03/2007 8.07

Reply | Threaded
Open this post in threaded view
|

RE: Selectors as variables?

Mark Plas

Here are my results. A remark though: There is a difference in performance when you declare the variables ‘b’ and ‘today’. The first measurements are without variable declarations and executed in a workspace with ‘auto declaration’ turned on. In the 2nd example, the variables are declared which makes quite an improvement.

 

today := Core.Date today.

b := [:date | date year].

Array

  with: (Core.Time millisecondsToRun: [10000000 timesRepeat: [today

perform: #year]])

  with: (Core.Time millisecondsToRun: [10000000 timesRepeat: [b value:

today]])

  with: (Core.Time millisecondsToRun: [10000000 timesRepeat: [ [:date | date year] value:

today]])  

 

#(361 343 251)

#(437 343 247)

#(461 339 243)

 #(368 340 240)

 

|today b|

today := Core.Date today.

b := [:date | date year].

Array

  with: (Core.Time millisecondsToRun: [10000000 timesRepeat: [today

perform: #year]])

  with: (Core.Time millisecondsToRun: [10000000 timesRepeat: [b value:

today]])

  with: (Core.Time millisecondsToRun: [10000000 timesRepeat: [ [:date | date year] value:

today]])

 

 #(253 158 153)

 #(306 155 154)

  #(332 159 160)

  #(333 164 245)

 


From: Björn Eiderbäck [mailto:[hidden email]]
Sent: donderdag 22 maart 2007 10:51
To: vwnc
Subject: RE: Selectors as variables?

 

I made the following change

Array

  with: (Core.Time millisecondsToRun: [10000000 timesRepeat: [today

perform: #year]])

  with: (Core.Time millisecondsToRun: [10000000 timesRepeat: [b value:

today]])

  with: (Core.Time millisecondsToRun: [10000000 timesRepeat: [ [:date | date year] value:

today]])

 

i.e. added the last test where b is inlined.

And got the following results from three runs:

#(381 620 438)

#(380 632 452)

#(383 627 457)

 

From: Giorgio Ferraris [mailto:[hidden email]]
Sent: den 21 mars 2007 19:19
To: 'Travis Griggs'; 'vwnc'
Subject: R: Selectors as variables?

 

Hi,

VW741

Version Id:

            #[60 41 60 64 74 1 0 0 60 41 60 64]

Windows xp sp2,

Pentium M 2.13.mhz

 

My result are:

 

#(363 304)

#(416 313)

#(351 314)

 

Much slower (so, what  cpu are you testing on?) and… perform slower than block!!!!

 

What happens?

 

Ciao

 

Giorgio

 


Da: Travis Griggs [mailto:[hidden email]]
Inviato: mercoledì 21 marzo 2007 0.00
A: vwnc
Oggetto: Re: Selectors as variables?

 

 

On Mar 20, 2007, at 14:16, Boris Popov wrote:

 

"I put forward the use of perform'ed symbols for the character scanners.

You've got me wondering if now if these tables wouldn't be better of as

tables of blocks. Since a block invokation is faster than a symbol

perform and that's a speed critical area."

 

Is it actually faster?

 

today := Core.Date today.

b := [:date | date year].

Array

  with: (Core.Time millisecondsToRun: [10000000 timesRepeat: [today

perform: #year]])

  with: (Core.Time millisecondsToRun: [10000000 timesRepeat: [b value:

today]])

 

Welll.... uh... duh. :)

 

I ASSumed that since the Symbol>>value: trick is about 60% as fast as the single arg block in an enumeration, that... On my machine, I ran 10x the iterations and reduced it to yourself sends. It's a wash on this box. But yes, there is no reason to use the blocks instead of a perform:'ed symbol. And I would argue that since there's no speed gain, the symbol dispatch table is far more concise then initializing it with blocks. Thanks for validating the original example. :)

 

--

Travis Griggs

Objologist

What's next, Intel Processors branded with "Apple Outside" stickers?

 

 

 

--
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.5.446 / Virus Database: 268.18.13/726 - Release Date: 18/03/2007 15.34

 

--
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.5.446 / Virus Database: 268.18.15/728 - Release Date: 20/03/2007 8.07

Reply | Threaded
Open this post in threaded view
|

Re: R: Selectors as variables?

Charles A. Monteiro-2
In reply to this post by Travis Griggs-3
question? how many engineers at Cincom Smalltalk actually as a norm code  
and test on a MAC?  Travis I really hope you have a Win box :)


On Wed, 21 Mar 2007 13:27:40 -0500, Travis Griggs <[hidden email]>  
wrote:

> On Mar 21, 2007, at 11:19, Giorgio Ferraris wrote:
>
>> Hi,
>>
>> VW741
>>
>> Version Id:
>>
>>             #[60 41 60 64 74 1 0 0 60 41 60 64]
>>
>> Windows xp sp2,
>>
>> Pentium M 2.13.mhz
>>
>>
>>
>> My result are:
>>
>>
>>
>> #(363 304)
>>
>> #(416 313)
>>
>> #(351 314)
>>
>>
>>
>> Much slower (so, what  cpu are you testing on?) and… perform slower
>> than block!!!
> Giorgio,
>
> What's what there? Which is block and which is perform? I always try
> to get up into 1000's of milliseconds to wash out "noise". My test
> was on a G4.
>
> --
> Travis Griggs
> Objologist
> 10 2 letter words: "If it is to be, it is up to me"
>
>



--
Charles A. Monteiro
http://wiki.nycsmalltalk.org
http://www.monteirosfusion.com
http://monteirofusion.blogspot.com

Reply | Threaded
Open this post in threaded view
|

Re: R: Selectors as variables?

Dave Stevenson-2
Code on a Mac? I thought that was a deployment-only platform?

:)

Dave

Charles A. Monteiro wrote:

> question? how many engineers at Cincom Smalltalk actually as a norm code
> and test on a MAC?  Travis I really hope you have a Win box :)
>
>
> On Wed, 21 Mar 2007 13:27:40 -0500, Travis Griggs <[hidden email]>
> wrote:
>
>> On Mar 21, 2007, at 11:19, Giorgio Ferraris wrote:
>>
>>> Hi,
>>>
>>> VW741
>>>
>>> Version Id:
>>>
>>>             #[60 41 60 64 74 1 0 0 60 41 60 64]
>>>
>>> Windows xp sp2,
>>>
>>> Pentium M 2.13.mhz
>>>
>>>
>>>
>>> My result are:
>>>
>>>
>>>
>>> #(363 304)
>>>
>>> #(416 313)
>>>
>>> #(351 314)
>>>
>>>
>>>
>>> Much slower (so, what  cpu are you testing on?) and… perform slower
>>> than block!!!
>> Giorgio,
>>
>> What's what there? Which is block and which is perform? I always try
>> to get up into 1000's of milliseconds to wash out "noise". My test
>> was on a G4.
>>
>> --
>> Travis Griggs
>> Objologist
>> 10 2 letter words: "If it is to be, it is up to me"
>>
>>
>
>
>
> --Charles A. Monteiro
> http://wiki.nycsmalltalk.org
> http://www.monteirosfusion.com
> http://monteirofusion.blogspot.com
>
>

Reply | Threaded
Open this post in threaded view
|

Re: R: Selectors as variables?

Charles A. Monteiro-2
it better be , Wall Street ain't on MACs :), I doubt if Main St is either,  
Geek Street , no doubt

btw, I have a G3 I have been meaning to put Linux on :)

On Thu, 22 Mar 2007 11:27:32 -0500, Dave Stevenson <[hidden email]>  
wrote:

> Code on a Mac? I thought that was a deployment-only platform?
>
> :)
>
> Dave
>
> Charles A. Monteiro wrote:
>> question? how many engineers at Cincom Smalltalk actually as a norm  
>> code and test on a MAC?  Travis I really hope you have a Win box :)
>>   On Wed, 21 Mar 2007 13:27:40 -0500, Travis Griggs  
>> <[hidden email]> wrote:
>>
>>> On Mar 21, 2007, at 11:19, Giorgio Ferraris wrote:
>>>
>>>> Hi,
>>>>
>>>> VW741
>>>>
>>>> Version Id:
>>>>
>>>>             #[60 41 60 64 74 1 0 0 60 41 60 64]
>>>>
>>>> Windows xp sp2,
>>>>
>>>> Pentium M 2.13.mhz
>>>>
>>>>
>>>>
>>>> My result are:
>>>>
>>>>
>>>>
>>>> #(363 304)
>>>>
>>>> #(416 313)
>>>>
>>>> #(351 314)
>>>>
>>>>
>>>>
>>>> Much slower (so, what  cpu are you testing on?) and… perform slower
>>>> than block!!!
>>> Giorgio,
>>>
>>> What's what there? Which is block and which is perform? I always try
>>> to get up into 1000's of milliseconds to wash out "noise". My test
>>> was on a G4.
>>>
>>> -- Travis Griggs
>>> Objologist
>>> 10 2 letter words: "If it is to be, it is up to me"
>>>
>>>
>>    --Charles A. Monteiro
>> http://wiki.nycsmalltalk.org
>> http://www.monteirosfusion.com
>> http://monteirofusion.blogspot.com
>>



--
Charles A. Monteiro
http://wiki.nycsmalltalk.org
http://www.monteirosfusion.com
http://monteirofusion.blogspot.com

Reply | Threaded
Open this post in threaded view
|

AW: Selectors as variables?

Nowak, Helge
In reply to this post by Mark Plas
Pentium 4 M, 1.80 GHz, 256GB RAM, Windows 2000:
 
today := Core.Date today.
b := [:date | date year].
Array
  with: (Core.Time millisecondsToRun: [10000000 timesRepeat: [today perform: #year]])
  with: (Core.Time millisecondsToRun: [10000000 timesRepeat: [b value: today]])
  with: (Core.Time millisecondsToRun: [10000000 timesRepeat: [ [:date | date year] value: today]])  
#(529 631 386)
#(430 543 359)
#(450 616 378)
|today b|
today := Core.Date today.
b := [:date | date year].
Array
  with: (Core.Time millisecondsToRun: [10000000 timesRepeat: [today perform: #year]])
  with: (Core.Time millisecondsToRun: [10000000 timesRepeat: [b value: today]])
  with: (Core.Time millisecondsToRun: [10000000 timesRepeat: [ [:date | date year] value: today]])  
#(280 270 287)
#(295 309 291)
#(280 348 227)

-----Ursprüngliche Nachricht-----
Von: Mark Plas [mailto:[hidden email]]
Gesendet: Donnerstag, 22. März 2007 11:06
An: vwnc
Betreff: RE: Selectors as variables?

Here are my results. A remark though: There is a difference in performance when you declare the variables ‘b’ and ‘today’. The first measurements are without variable declarations and executed in a workspace with ‘auto declaration’ turned on. In the 2nd example, the variables are declared which makes quite an improvement.

 

today := Core.Date today.

b := [:date | date year].

Array

  with: (Core.Time millisecondsToRun: [10000000 timesRepeat: [today

perform: #year]])

  with: (Core.Time millisecondsToRun: [10000000 timesRepeat: [b value:

today]])

  with: (Core.Time millisecondsToRun: [10000000 timesRepeat: [ [:date | date year] value:

today]])  

 

#(361 343 251)

#(437 343 247)

#(461 339 243)

 #(368 340 240)

 

|today b|

today := Core.Date today.

b := [:date | date year].

Array

  with: (Core.Time millisecondsToRun: [10000000 timesRepeat: [today

perform: #year]])

  with: (Core.Time millisecondsToRun: [10000000 timesRepeat: [b value:

today]])

  with: (Core.Time millisecondsToRun: [10000000 timesRepeat: [ [:date | date year] value:

today]])

 

 #(253 158 153)

 #(306 155 154)

  #(332 159 160)

  #(333 164 245)

 


From: Björn Eiderbäck [mailto:[hidden email]]
Sent: donderdag 22 maart 2007 10:51
To: vwnc
Subject: RE: Selectors as variables?

 

I made the following change

Array

  with: (Core.Time millisecondsToRun: [10000000 timesRepeat: [today

perform: #year]])

  with: (Core.Time millisecondsToRun: [10000000 timesRepeat: [b value:

today]])

  with: (Core.Time millisecondsToRun: [10000000 timesRepeat: [ [:date | date year] value:

today]])

 

i.e. added the last test where b is inlined.

And got the following results from three runs:

#(381 620 438)

#(380 632 452)

#(383 627 457)

 

From: Giorgio Ferraris [mailto:[hidden email]]
Sent: den 21 mars 2007 19:19
To: 'Travis Griggs'; 'vwnc'
Subject: R: Selectors as variables?

 

Hi,

VW741

Version Id:

            #[60 41 60 64 74 1 0 0 60 41 60 64]

Windows xp sp2,

Pentium M 2.13.mhz

 

My result are:

 

#(363 304)

#(416 313)

#(351 314)

 

Much slower (so, what  cpu are you testing on?) and… perform slower than block!!!!

 

What happens?

 

Ciao

 

Giorgio

 


Da: Travis Griggs [mailto:[hidden email]]
Inviato: mercoledì 21 marzo 2007 0.00
A: vwnc
Oggetto: Re: Selectors as variables?

 

 

On Mar 20, 2007, at 14:16, Boris Popov wrote:

 

"I put forward the use of perform'ed symbols for the character scanners.

You've got me wondering if now if these tables wouldn't be better of as

tables of blocks. Since a block invokation is faster than a symbol

perform and that's a speed critical area."

 

Is it actually faster?

 

today := Core.Date today.

b := [:date | date year].

Array

  with: (Core.Time millisecondsToRun: [10000000 timesRepeat: [today

perform: #year]])

  with: (Core.Time millisecondsToRun: [10000000 timesRepeat: [b value:

today]])

 

Welll.... uh... duh. :)

 

I ASSumed that since the Symbol>>value: trick is about 60% as fast as the single arg block in an enumeration, that... On my machine, I ran 10x the iterations and reduced it to yourself sends. It's a wash on this box. But yes, there is no reason to use the blocks instead of a perform:'ed symbol. And I would argue that since there's no speed gain, the symbol dispatch table is far more concise then initializing it with blocks. Thanks for validating the original example. :)

 

--

Travis Griggs

Objologist

What's next, Intel Processors branded with "Apple Outside" stickers?

 

 

 

--
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.5.446 / Virus Database: 268.18.13/726 - Release Date: 18/03/2007 15.34

 

--
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.5.446 / Virus Database: 268.18.15/728 - Release Date: 20/03/2007 8.07

Reply | Threaded
Open this post in threaded view
|

RE: Selectors as variables?

Boris Popov, DeepCove Labs (SNN)

Intel Core Duo 2 / 6600 @ 2.4Ghz,

 

2 Processor(s) Installed.

[01]: x86 Family 6 Model 15 Stepping 6 GenuineIntel ~2392 Mhz

[02]: x86 Family 6 Model 15 Stepping 6 GenuineIntel ~2392 Mhz

 

today := Core.Date today.

b := [:date | date year].

Array

  with: (Core.Time millisecondsToRun: [10000000 timesRepeat: [today perform: #year]])

  with: (Core.Time millisecondsToRun: [10000000 timesRepeat: [b value: today]])

  with: (Core.Time millisecondsToRun: [10000000 timesRepeat: [ [:date | date year] value: today]])

 

#(169 210 144)

#(175 218 144)

#(161 219 151)

 

| today b |

today := Core.Date today.

b := [:date | date year].

Array

  with: (Core.Time millisecondsToRun: [10000000 timesRepeat: [today perform: #year]])

  with: (Core.Time millisecondsToRun: [10000000 timesRepeat: [b value: today]])

  with: (Core.Time millisecondsToRun: [10000000 timesRepeat: [ [:date | date year] value: today]])

 

#(88 102 92)

#(92 105 92)

#(93 101 92)

-Boris

--
+1.604.689.0322
DeepCove Labs Ltd.
4th floor 595 Howe Street
Vancouver, Canada V6C 2T5
http://tinyurl.com/r7uw4

[hidden email]

CONFIDENTIALITY NOTICE

This email is intended only for the persons named in the message
header. Unless otherwise indicated, it contains information that is
private and confidential. If you have received it in error, please
notify the sender and delete the entire message including any
attachments.

Thank you.


From: Nowak, Helge [mailto:[hidden email]]
Sent: Thursday, March 22, 2007 10:18 AM
To: Mark Plas; vwnc
Subject: AW: Selectors as variables?

 

Pentium 4 M, 1.80 GHz, 256GB RAM, Windows 2000:

 

today := Core.Date today.
b := [:date | date year].
Array
  with: (Core.Time millisecondsToRun: [10000000 timesRepeat: [today perform: #year]])
  with: (Core.Time millisecondsToRun: [10000000 timesRepeat: [b value: today]])
  with: (Core.Time millisecondsToRun: [10000000 timesRepeat: [ [:date | date year] value: today]])  

#(529 631 386)

#(430 543 359)
#(450 616 378)

|today b|
today := Core.Date today.
b := [:date | date year].
Array
  with: (Core.Time millisecondsToRun: [10000000 timesRepeat: [today perform: #year]])
  with: (Core.Time millisecondsToRun: [10000000 timesRepeat: [b value: today]])
  with: (Core.Time millisecondsToRun: [10000000 timesRepeat: [ [:date | date year] value: today]])  

#(280 270 287)

#(295 309 291)
#(280 348 227)

-----Ursprüngliche Nachricht-----
Von: Mark Plas [mailto:[hidden email]]
Gesendet: Donnerstag, 22. März 2007 11:06
An: vwnc
Betreff: RE: Selectors as variables?

Here are my results. A remark though: There is a difference in performance when you declare the variables ‘b’ and ‘today’. The first measurements are without variable declarations and executed in a workspace with ‘auto declaration’ turned on. In the 2nd example, the variables are declared which makes quite an improvement.

 

today := Core.Date today.

b := [:date | date year].

Array

  with: (Core.Time millisecondsToRun: [10000000 timesRepeat: [today

perform: #year]])

  with: (Core.Time millisecondsToRun: [10000000 timesRepeat: [b value:

today]])

  with: (Core.Time millisecondsToRun: [10000000 timesRepeat: [ [:date | date year] value:

today]])  

 

#(361 343 251)

#(437 343 247)

#(461 339 243)

 #(368 340 240)

 

|today b|

today := Core.Date today.

b := [:date | date year].

Array

  with: (Core.Time millisecondsToRun: [10000000 timesRepeat: [today

perform: #year]])

  with: (Core.Time millisecondsToRun: [10000000 timesRepeat: [b value:

today]])

  with: (Core.Time millisecondsToRun: [10000000 timesRepeat: [ [:date | date year] value:

today]])

 

 #(253 158 153)

 #(306 155 154)

  #(332 159 160)

  #(333 164 245)

 


From: Björn Eiderbäck [mailto:[hidden email]]
Sent: donderdag 22 maart 2007 10:51
To: vwnc
Subject: RE: Selectors as variables?

 

I made the following change

Array

  with: (Core.Time millisecondsToRun: [10000000 timesRepeat: [today

perform: #year]])

  with: (Core.Time millisecondsToRun: [10000000 timesRepeat: [b value:

today]])

  with: (Core.Time millisecondsToRun: [10000000 timesRepeat: [ [:date | date year] value:

today]])

 

i.e. added the last test where b is inlined.

And got the following results from three runs:

#(381 620 438)

#(380 632 452)

#(383 627 457)

 

From: Giorgio Ferraris [mailto:[hidden email]]
Sent: den 21 mars 2007 19:19
To: 'Travis Griggs'; 'vwnc'
Subject: R: Selectors as variables?

 

Hi,

VW741

Version Id:

            #[60 41 60 64 74 1 0 0 60 41 60 64]

Windows xp sp2,

Pentium M 2.13.mhz

 

My result are:

 

#(363 304)

#(416 313)

#(351 314)

 

Much slower (so, what  cpu are you testing on?) and… perform slower than block!!!!

 

What happens?

 

Ciao

 

Giorgio

 


Da: Travis Griggs [mailto:[hidden email]]
Inviato: mercoledì 21 marzo 2007 0.00
A: vwnc
Oggetto: Re: Selectors as variables?

 

 

On Mar 20, 2007, at 14:16, Boris Popov wrote:

 

"I put forward the use of perform'ed symbols for the character scanners.

You've got me wondering if now if these tables wouldn't be better of as

tables of blocks. Since a block invokation is faster than a symbol

perform and that's a speed critical area."

 

Is it actually faster?

 

today := Core.Date today.

b := [:date | date year].

Array

  with: (Core.Time millisecondsToRun: [10000000 timesRepeat: [today

perform: #year]])

  with: (Core.Time millisecondsToRun: [10000000 timesRepeat: [b value:

today]])

 

Welll.... uh... duh. :)

 

I ASSumed that since the Symbol>>value: trick is about 60% as fast as the single arg block in an enumeration, that... On my machine, I ran 10x the iterations and reduced it to yourself sends. It's a wash on this box. But yes, there is no reason to use the blocks instead of a perform:'ed symbol. And I would argue that since there's no speed gain, the symbol dispatch table is far more concise then initializing it with blocks. Thanks for validating the original example. :)

 

--

Travis Griggs

Objologist

What's next, Intel Processors branded with "Apple Outside" stickers?

 

 

 

--
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.5.446 / Virus Database: 268.18.13/726 - Release Date: 18/03/2007 15.34

 

--
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.5.446 / Virus Database: 268.18.15/728 - Release Date: 20/03/2007 8.07

Reply | Threaded
Open this post in threaded view
|

R: R: Selectors as variables?

Giorgio Ferraris
In reply to this post by Travis Griggs-3

Travis,

 

I’m using the same code as the starting post:

>> 

>today := Core.Date today.

>b := [:date | date year].

>Array

>  with: (Core.Time millisecondsToRun: [10000000 timesRepeat: [today

>perform: #year]])

 > with: (Core.Time millisecondsToRun: [10000000 timesRepeat: [b value:

>today]])

> 

>#(181 288)

>#(157 207)

>#(183 214)

 

My results are opposite to the ones above:

 

#(363 304)

#(416 313)

#(351 314)

 

How can it be explained?

 

Ciao

 

Giorgio


Da: Travis Griggs [mailto:[hidden email]]
Inviato: mercoledì 21 marzo 2007 19.28
A: vwnc
Oggetto: Re: R: Selectors as variables?

 

On Mar 21, 2007, at 11:19, Giorgio Ferraris wrote:

 

Hi,

VW741

Version Id:

            #[60 41 60 64 74 1 0 0 60 41 60 64]

Windows xp sp2,

Pentium M 2.13.mhz

 

My result are:

 

#(363 304)

#(416 313)

#(351 314)

 

Much slower (so, what  cpu are you testing on?) and… perform slower than block!!!

Giorgio,

 

What's what there? Which is block and which is perform? I always try to get up into 1000's of milliseconds to wash out "noise". My test was on a G4.

 

--

Travis Griggs

Objologist

10 2 letter words: "If it is to be, it is up to me"

 

 


--
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.5.446 / Virus Database: 268.18.15/728 - Release Date: 20/03/2007 8.07


--
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.5.446 / Virus Database: 268.18.15/728 - Release Date: 20/03/2007 8.07

Reply | Threaded
Open this post in threaded view
|

RE: R: Selectors as variables?

Boris Popov, DeepCove Labs (SNN)
Giorgio,

Can you try these as well please?

today := Core.Date today.
b := [:date | date year].
Array
  with: (Core.Time millisecondsToRun: [10000000 timesRepeat: [today perform: #year]])
  with: (Core.Time millisecondsToRun: [10000000 timesRepeat: [b value: today]])
  with: (Core.Time millisecondsToRun: [10000000 timesRepeat: [ [:date | date year] value: today]])

 
#(169 210 144)
#(175 218 144)
#(161 219 151)


| today b |
today := Core.Date today.
b := [:date | date year].
Array
  with: (Core.Time millisecondsToRun: [10000000 timesRepeat: [today perform: #year]])
  with: (Core.Time millisecondsToRun: [10000000 timesRepeat: [b value: today]])
  with: (Core.Time millisecondsToRun: [10000000 timesRepeat: [ [:date | date year] value: today]])
 

#(88 102 92)
#(92 105 92)
#(93 101 92)

-Boris

--
+1.604.689.0322
DeepCove Labs Ltd.
4th floor 595 Howe Street
Vancouver, Canada V6C 2T5
http://tinyurl.com/r7uw4

[hidden email]

CONFIDENTIALITY NOTICE

This email is intended only for the persons named in the message
header. Unless otherwise indicated, it contains information that is
private and confidential. If you have received it in error, please
notify the sender and delete the entire message including any
attachments.

Thank you.

> -----Original Message-----
> From: Giorgio Ferraris [mailto:[hidden email]]
> Sent: Thursday, March 22, 2007 3:01 PM
> To: 'Travis Griggs'; 'vwnc'
> Subject: R: R: Selectors as variables?
>
> Travis,
>
>
>
> I'm using the same code as the starting post:
>
> >>
>
> >today := Core.Date today.
>
> >b := [:date | date year].
>
> >Array
>
> >  with: (Core.Time millisecondsToRun: [10000000 timesRepeat: [today
>
> >perform: #year]])
>
>  > with: (Core.Time millisecondsToRun: [10000000 timesRepeat: [b value:
>
> >today]])
>
> >
>
> >#(181 288)
>
> >#(157 207)
>
> >#(183 214)
>
>
>
> My results are opposite to the ones above:
>
>
>
> #(363 304)
>
> #(416 313)
>
> #(351 314)
>
>
>
> How can it be explained?
>
>
>
> Ciao
>
>
>
> Giorgio
>
> ________________________________
>
> Da: Travis Griggs [mailto:[hidden email]]
> Inviato: mercoledì 21 marzo 2007 19.28
> A: vwnc
> Oggetto: Re: R: Selectors as variables?
>
>
>
> On Mar 21, 2007, at 11:19, Giorgio Ferraris wrote:
>
>
>
> Hi,
>
> VW741
>
> Version Id:
>
>             #[60 41 60 64 74 1 0 0 60 41 60 64]
>
> Windows xp sp2,
>
> Pentium M 2.13.mhz
>
>
>
> My result are:
>
>
>
> #(363 304)
>
> #(416 313)
>
> #(351 314)
>
>
>
> Much slower (so, what  cpu are you testing on?) and... perform slower than
> block!!!
>
> Giorgio,
>
>
>
> What's what there? Which is block and which is perform? I always try to
> get up into 1000's of milliseconds to wash out "noise". My test was on a
> G4.
>
>
>
> --
>
> Travis Griggs
>
> Objologist
>
> 10 2 letter words: "If it is to be, it is up to me"
>
>
>
>
>
>
> --
> No virus found in this incoming message.
> Checked by AVG Free Edition.
> Version: 7.5.446 / Virus Database: 268.18.15/728 - Release Date:
> 20/03/2007 8.07
>
>
>
> --
> No virus found in this outgoing message.
> Checked by AVG Free Edition.
> Version: 7.5.446 / Virus Database: 268.18.15/728 - Release Date:
> 20/03/2007 8.07
>

Reply | Threaded
Open this post in threaded view
|

R: R: Selectors as variables?

Giorgio Ferraris
Yes, Shure, Boris

today := Core.Date today.
b := [:date | date year].
Array
  with: (Core.Time millisecondsToRun: [10000000 timesRepeat: [today perform:
#year]])
  with: (Core.Time millisecondsToRun: [10000000 timesRepeat: [b value:
today]])
  with: (Core.Time millisecondsToRun: [10000000 timesRepeat: [ [:date | date
year] value: today]])
 #(337 319 224)
 #(399 315 224)
#(398 319 227)


| today b |
today := Core.Date today.
b := [:date | date year].
Array
  with: (Core.Time millisecondsToRun: [10000000 timesRepeat: [today perform:
#year]])
  with: (Core.Time millisecondsToRun: [10000000 timesRepeat: [b value:
today]])
  with: (Core.Time millisecondsToRun: [10000000 timesRepeat: [ [:date | date
year] value: today]])  
 #(244 145 143)
#(292 151 143)
 #(329 147 142)


Still first is slower than second, opposite to your!
Ciao

Giorgio



-----Messaggio originale-----
Da: Boris Popov [mailto:[hidden email]]
Inviato: giovedì 22 marzo 2007 23.06
A: Giorgio Ferraris; Travis Griggs; vwnc
Oggetto: RE: R: Selectors as variables?

Giorgio,

Can you try these as well please?

today := Core.Date today.
b := [:date | date year].
Array
  with: (Core.Time millisecondsToRun: [10000000 timesRepeat: [today perform:
#year]])
  with: (Core.Time millisecondsToRun: [10000000 timesRepeat: [b value:
today]])
  with: (Core.Time millisecondsToRun: [10000000 timesRepeat: [ [:date | date
year] value: today]])

 
#(169 210 144)
#(175 218 144)
#(161 219 151)


| today b |
today := Core.Date today.
b := [:date | date year].
Array
  with: (Core.Time millisecondsToRun: [10000000 timesRepeat: [today perform:
#year]])
  with: (Core.Time millisecondsToRun: [10000000 timesRepeat: [b value:
today]])
  with: (Core.Time millisecondsToRun: [10000000 timesRepeat: [ [:date | date
year] value: today]])
 

#(88 102 92)
#(92 105 92)
#(93 101 92)

-Boris

--
+1.604.689.0322
DeepCove Labs Ltd.
4th floor 595 Howe Street
Vancouver, Canada V6C 2T5
http://tinyurl.com/r7uw4

[hidden email]

CONFIDENTIALITY NOTICE

This email is intended only for the persons named in the message
header. Unless otherwise indicated, it contains information that is
private and confidential. If you have received it in error, please
notify the sender and delete the entire message including any
attachments.

Thank you.

> -----Original Message-----
> From: Giorgio Ferraris [mailto:[hidden email]]
> Sent: Thursday, March 22, 2007 3:01 PM
> To: 'Travis Griggs'; 'vwnc'
> Subject: R: R: Selectors as variables?
>
> Travis,
>
>
>
> I'm using the same code as the starting post:
>
> >>
>
> >today := Core.Date today.
>
> >b := [:date | date year].
>
> >Array
>
> >  with: (Core.Time millisecondsToRun: [10000000 timesRepeat: [today
>
> >perform: #year]])
>
>  > with: (Core.Time millisecondsToRun: [10000000 timesRepeat: [b value:
>
> >today]])
>
> >
>
> >#(181 288)
>
> >#(157 207)
>
> >#(183 214)
>
>
>
> My results are opposite to the ones above:
>
>
>
> #(363 304)
>
> #(416 313)
>
> #(351 314)
>
>
>
> How can it be explained?
>
>
>
> Ciao
>
>
>
> Giorgio
>
> ________________________________
>
> Da: Travis Griggs [mailto:[hidden email]]
> Inviato: mercoledì 21 marzo 2007 19.28
> A: vwnc
> Oggetto: Re: R: Selectors as variables?
>
>
>
> On Mar 21, 2007, at 11:19, Giorgio Ferraris wrote:
>
>
>
> Hi,
>
> VW741
>
> Version Id:
>
>             #[60 41 60 64 74 1 0 0 60 41 60 64]
>
> Windows xp sp2,
>
> Pentium M 2.13.mhz
>
>
>
> My result are:
>
>
>
> #(363 304)
>
> #(416 313)
>
> #(351 314)
>
>
>
> Much slower (so, what  cpu are you testing on?) and... perform slower than
> block!!!
>
> Giorgio,
>
>
>
> What's what there? Which is block and which is perform? I always try to
> get up into 1000's of milliseconds to wash out "noise". My test was on a
> G4.
>
>
>
> --
>
> Travis Griggs
>
> Objologist
>
> 10 2 letter words: "If it is to be, it is up to me"
>
>
>
>
>
>
> --
> No virus found in this incoming message.
> Checked by AVG Free Edition.
> Version: 7.5.446 / Virus Database: 268.18.15/728 - Release Date:
> 20/03/2007 8.07
>
>
>
> --
> No virus found in this outgoing message.
> Checked by AVG Free Edition.
> Version: 7.5.446 / Virus Database: 268.18.15/728 - Release Date:
> 20/03/2007 8.07
>

--
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.5.446 / Virus Database: 268.18.15/728 - Release Date: 20/03/2007
8.07
 

--
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.5.446 / Virus Database: 268.18.15/728 - Release Date: 20/03/2007
8.07
 

123