The Artima Developer Community
Sponsored Link

Agile Buzz Forum
Code Counting

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
James Robertson

Posts: 29924
Nickname: jarober61
Registered: Jun, 2003

David Buck, Smalltalker at large
Code Counting Posted: Oct 8, 2008 3:42 AM
Reply to this message Reply

This post originated from an RSS feed registered with Agile Buzz by James Robertson.
Original Post: Code Counting
Feed Title: Cincom Smalltalk Blog - Smalltalk with Rants
Feed URL: http://www.cincomsmalltalk.com/rssBlog/rssBlogView.xml
Feed Description: James Robertson comments on Cincom Smalltalk, the Smalltalk development community, and IT trends and issues in general.
Latest Agile Buzz Posts
Latest Agile Buzz Posts by James Robertson
Latest Posts From Cincom Smalltalk Blog - Smalltalk with Rants

Advertisement

Travis posed an interesting thought: within a body of code, which methods get sent most often? He used this little code snippet to find out:


bag := Bag new. 
bundle := Store.Registry bundleNamed: 'BottomFeeder'. 
bundle leafItems	do:		
	[:pkg | 		
	pkg compiledMethods do:				
		[:each | each resourceType ifNil: [each messagesDo: [:selector | bag add: selector]]]]. 
sorted := bag contents associations sorted: [:a :b | a value > b value].

He then did it again using a multiplier for message length. Curious, I tried that out on the BottomFeeder bundle, and discovered that I mostly send core system messages:

isNil691
new685
add:503
nextPutAll:496
,496
<<488
>>488
->361
notNil308
settings308

I see that I do a fair amount of comparisons in there - applying the multiplier::

nextPutAll:5456
isNil3455
settings2464
asString2144
new2055
add:2012
notNil1848
printString1639
at:put:1582
replaceFrom:to:with:startingAt:1581

I guess I create a lot of new objects, and work with a lot of streams :)

Read: Code Counting

Topic: Agile 2008 Post Roundup Previous Topic   Next Topic Topic: Thinly Sliced: Monticello2 at Smalltalk Solutions

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use