Hi,
Review needed for
https://pharo.fogbugz.com/f/cases/16074/Is-RBClassNotReferencedRule-200x-slower-in-Pharo-4-vs-Pharo-3
Speedup can be checked with:
rule:=RBClassNotReferencedRule new.
environment:=RBBrowserEnvironment new forPackageNames: #('Fuel').
[RBSmalllintChecker runRule: rule onEnvironment:
environment] timeToRun
Pharo5: "0:00:00:13.526"
Pharo5 with fix: "0:00:00:00.761"
Pharo3: 0:00:00:00.547
Checking all classes for usage:
[Smalltalk allClassesAndTraits select: [ : each | each isUsed not]] timeToRun
still takes 1:40 to find 600 unused classes.
This shows that adding a cache for “referenced classes” per environment would
speed this
up further. But it should be general, not just for RB or even RB Code Critique.
The nice things is that code environments only change when you add classes or
methods,
so adding a very general cache should be quite possible.
Another thing we should add is a way for classes to define “I am used”. E.g this
now finds all Configurations, all the Manifests and all cases like the RB Rules
themselves.
All these should know that they are not useless even though there are no
references.
Marcus