Function frequency: Difference between revisions

(→‎{{header|Raku}}: Fix code and comments: Perl 6 --> Raku)
Line 1,972:
Function `bar` (declared at line 2) is used 2 times
</pre>
 
=={{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.
 
<lang smalltalk>bagOfCalls := Bag new.
Smalltalk allClassesDo:[:cls |
cls instAndClassMethodsDo:[:mthd |
bagOfCalls addAll:mthd messagesSent
].
].
(bagOfCalls sortedCounts to:10) do:[:assoc |
Stdout printCR: e'method {assoc value} is called {assoc key} times.'
].</lang>
{{out}}
<pre>method ifTrue:is called 19805 times.
method notNil is called 8731 times.
method isNil is called 8616 times.
method ifTrue:ifFalse: is called 6833 times.
method == is called 6655 times.
method new is called 6088 times.
method ifFalse: is called 4640 times.
method and: is called 4389 times.
method size is called 3800 times.
method + is called 3737 times.</pre>
 
=={{header|Tcl}}==
Anonymous user