Function frequency: Difference between revisions

Line 1,975:
=={{header|Smalltalk}}==
{{works with|Smalltalk/X}}
This parses all classes of all loaded packages/libraries (takes a few seconds); the results below are printed in scripting mode, where only a small part of the system is actually preloaded. From the code, it should be obvious how to restrict the search to packages, libraries, classes or individual methods.
 
<lang smalltalk>bagOfCalls := Bag new.
Line 1,986:
Stdout printCR: e'method {assoc value} is called {assoc key} times.'
].</lang>
note: messagesSent calls the parser for an AST and enumerates the parse nodes; it does not know, which get inlined and which end up being called actually (in fact, most of the one's below are probably inlined).
 
The results below were printed in scripting mode, where only a small part of the system is actually preloaded.
{{out}}
<pre>method ifTrue:is called 19805 times.
Anonymous user