ClassTestCase

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

Re: ClassTestCase

Levente Uzonyi-2
On Mon, 24 May 2010, John M McIntosh wrote:

>
> On 2010-05-24, at 1:47 PM, Levente Uzonyi wrote:
>
>> On Mon, 24 May 2010, Lukas Renggli wrote:
>>
>>>> IMHO 4 is the most readable and it is the fastest in Pharo/Squeak at the
>>>> moment, so that should be preferred in core packages.
>>>
>>> It should not be preferred or changes unless you can prove a real
>>> performance benefit. I still haven't seen a single realistic benchmark
>>> with real code (from Pharo, Seaside, Pier, ...) where you can measure
>>> a real difference between these 4 variants.
>>
>> Well, just replace all uses of == nil and #ifNil:, etc with isNil and isNil ifTrue: etc. Then get some benchmarks which you accept as realistic and run them in both images.
>>
>
>
> Well what is going on is that you are changing the
> foo isNil ifTrue:
> which is a message send for the isNil into a
> foo == nil ifTrue:
> which then does an object identity check in byte codes.
>
> Because messages sends are *slow* removing one from millions of executions does improve things.
>
> However what be more clever is changing the compiler to optimize the use of isNil so you maintain readability without a performance penalty.

Is "isNil" really more readable than "== nil"?

>
> Also consider 'first' 'second'
>
> Well and the case of the simple accessor
>
> self foo ifTrue:[]
> where
> foo
> ^foo

Inlining more methods is a bad idea IMHO. It makes the compiler and the
decompiler more complex. An inlining JIT is the real solution.


Levente

>
>
> --
> ===========================================================================
> John M. McIntosh <[hidden email]>   Twitter:  squeaker68882
> Corporate Smalltalk Consulting Ltd.  http://www.smalltalkconsulting.com
> ===========================================================================
>
>
>
>
>

_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Reply | Threaded
Open this post in threaded view
|

Re: ClassTestCase

Francisco Ortiz Peñaloza
Is "isNil" really more readable than "== nil"?

imho yes... i find it more readable, more "smalltalkish" but the
conversation ended up being about performance rather than if it's more
readable or not so obviously there is a bigger issue :)

Francisco

On Mon, May 24, 2010 at 11:22 PM, Levente Uzonyi <[hidden email]> wrote:

> On Mon, 24 May 2010, John M McIntosh wrote:
>
>>
>> On 2010-05-24, at 1:47 PM, Levente Uzonyi wrote:
>>
>>> On Mon, 24 May 2010, Lukas Renggli wrote:
>>>
>>>>> IMHO 4 is the most readable and it is the fastest in Pharo/Squeak at
>>>>> the
>>>>> moment, so that should be preferred in core packages.
>>>>
>>>> It should not be preferred or changes unless you can prove a real
>>>> performance benefit. I still haven't seen a single realistic benchmark
>>>> with real code (from Pharo, Seaside, Pier, ...) where you can measure
>>>> a real difference between these 4 variants.
>>>
>>> Well, just replace all uses of == nil and #ifNil:, etc with isNil and
>>> isNil ifTrue: etc. Then get some benchmarks which you accept as realistic
>>> and run them in both images.
>>>
>>
>>
>> Well what is going on is that you are changing the
>> foo isNil ifTrue:
>> which is a message send for the isNil into a
>> foo == nil ifTrue:
>> which then does an object identity check in byte codes.
>>
>> Because messages sends are *slow* removing one from millions of executions
>> does improve things.
>>
>> However what be more clever is changing the compiler to optimize the use
>> of isNil so you maintain readability without a performance penalty.
>
> Is "isNil" really more readable than "== nil"?
>
>>
>> Also consider 'first' 'second'
>>
>> Well and the case of the simple accessor
>>
>> self foo ifTrue:[]
>> where
>> foo
>> ^foo
>
> Inlining more methods is a bad idea IMHO. It makes the compiler and the
> decompiler more complex. An inlining JIT is the real solution.
>
>
> Levente
>
>>
>>
>> --
>>
>> ===========================================================================
>> John M. McIntosh <[hidden email]>   Twitter:
>>  squeaker68882
>> Corporate Smalltalk Consulting Ltd.  http://www.smalltalkconsulting.com
>>
>> ===========================================================================
>>
>>
>>
>>
>>
>
> _______________________________________________
> Pharo-project mailing list
> [hidden email]
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>

_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Reply | Threaded
Open this post in threaded view
|

Re: ClassTestCase

johnmci
In reply to this post by Levente Uzonyi-2

On 2010-05-24, at 7:22 PM, Levente Uzonyi wrote:

> Inlining more methods is a bad idea IMHO. It makes the compiler and the decompiler more complex. An inlining JIT is the real solution.
>
>
> Levente


If it's smalltalk code underfoot then likely a bunch of people might have an interest or at least be able to hack, criticize, be happy, or ignore it.

If it's a JIT buried in SLANG, C or assembler then I'd guess not more than 5 people would know anything about how it works, or figure out
how to fix it.

--
===========================================================================
John M. McIntosh <[hidden email]>   Twitter:  squeaker68882
Corporate Smalltalk Consulting Ltd.  http://www.smalltalkconsulting.com
===========================================================================





_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project

smime.p7s (3K) Download Attachment
12