[squeak-dev] The Inbox: System-mt.697.mcz
Levente Uzonyi
leves at elte.hu
Tue Jan 27 21:21:17 UTC 2015
AndreasSystemProfiler has the same bug, and it's annoyed me forever, so
thanks for the fix.
I'm not an expert, but here's an example:
AndreasSystemProfiler spyOn: [
[ #((1 2 3)) do: [ :each |
each findLast: [ :ea |
ea squared = ea ] ] ] bench ].
Before the patch you got:
99.98 (5,018) UndefinedObject DoIt
10.39 (521) Array [SequenceableCollection] findLast:
9.68 (486) Array [SequenceableCollection] do:
5.94 (298) Time class millisecondClockValue
But the profiled block doesn't send #findLast, nor #do:, and neither
#millisecondClockValue. It sends #bench to a block, and nothing else.
After the fix it's:
99.98 (5,018) UndefinedObject DoIt
99.98 (5,018) BlockClosure bench
99.96 (5,017) UndefinedObject DoIt
20.9 (1,049) Array [SequenceableCollection] do:
|16.01 (804) UndefinedObject DoIt
| 16.01 (803) Array [SequenceableCollection] findLast:
5.7 (286) Time class millisecondClockValue
Which is much better, and almost exact. #millisecondsClockValue is sent
from #bench, not from a block.
Levente
On Tue, 27 Jan 2015, Chris Muller wrote:
> This is easy for an expert to glance at and understand the nature of
> the bug but could someone explain it to help our Smalltalk-user
> community understand what has been wrong with MessageTally all these
> years?
>
> Thanks!
>
> On Tue, Jan 27, 2015 at 12:54 PM, Bert Freudenberg <bert at freudenbergs.de> wrote:
>> On 27.01.2015, at 19:37, Eliot Miranda <eliot.miranda at gmail.com> wrote:
>>
>>
>> Wow, that's quite the bug :-)
>>
>>
>> Indeed. I wonder how this could have ever worked. Or maybe just nobody
>> noticed that certain chains were missing?
>>
>> - Bert -
>>
>>
>>
>> On Tue, Jan 27, 2015 at 8:53 AM, <commits at source.squeak.org> wrote:
>>>
>>> Marcel Taeumel uploaded a new version of System to project The Inbox:
>>> http://source.squeak.org/inbox/System-mt.697.mcz
>>>
>>> ==================== Summary ====================
>>>
>>> Name: System-mt.697
>>> Author: mt
>>> Time: 27 January 2015, 5:53:38.431 pm
>>> UUID: 9296f429-477d-0745-a878-6e11e7de5edd
>>> Ancestors: System-cmm.696
>>>
>>> Let message tally ignore #home but just use #sender to handle block
>>> closures correctly.
>>>
>>> =============== Diff against System-cmm.696 ===============
>>>
>>> Item was changed:
>>> ----- Method: MessageTally>>tally:by: (in category 'tallying') -----
>>> tally: context by: count
>>> "Explicitly tally the specified context and its stack."
>>> | sender |
>>>
>>> "Add to this node if appropriate"
>>> context method == method ifTrue: [^self bumpBy: count].
>>>
>>> "No sender? Add new branch to the tree."
>>> + (sender := context sender) ifNil: [
>>> - (sender := context home sender)ifNil: [
>>> ^ (self bumpBy: count) tallyPath: context by: count].
>>>
>>> "Find the node for the sending context (or add it if necessary)"
>>> ^ (self tally: sender by: count) tallyPath: context by: count!
>>>
>>> Item was changed:
>>> ----- Method: MessageTally>>tally:in:by: (in category 'tallying') -----
>>> tally: context in: aProcess by: count
>>> "Explicitly tally the specified context and its stack."
>>> | sender |
>>>
>>> "Add to this node if appropriate"
>>> context method == method ifTrue: [^self bumpBy: count].
>>>
>>> "No sender? Add new branch to the tree."
>>> + (sender := context sender) ifNil: [
>>> - (sender := context home sender) ifNil: [
>>> ^ (self bumpBy: count) tallyPath: context in: aProcess by:
>>> count].
>>>
>>> "Find the node for the sending context (or add it if necessary)"
>>> ^ (self tally: sender in: aProcess by: count) tallyPath: context
>>> in: aProcess by: count!
>>>
>>>
>>
>>
>>
>> --
>> best,
>> Eliot
>>
>>
>>
>>
>>
>>
>
>
More information about the Squeak-dev
mailing list
|