You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The method MCPackageLoader>>#basicLoadDefinitions loads classes twice. This is mentioned in its comment. However, the fact that classes is loaded twice leads to a significant slowdown especially in code that uses traits.
The screenshot above shows a profiler on loading GT. loadClassDefinition: which is the first pass to load classes and traits takes 7.3% of the time. Then tryToLoad: which should load methods also loads again classes. This time loading the same class definitions as before takes 30% of the time!!!
If we expand we see that most time is spend in the TraitBuilderEnhancher. For example when migrating class instances Behaviour class >>#allInstances is now called a lot, taking a significant amount of time.
I'm not sure if there are any side-effects but loading also class definitions while loading method definitions should not be necessary. One maybe naive solution is to have tryToLoad: as below. It does not attempt to load again class definitions.
I tried the above solution on loading the following code in a Pharo 9 image:
Time millisecondsToRun: [
Metacello new
repository: 'github://j-brant/smacc';
baseline: 'SmaCC';
load.
Metacello new
repository: 'github://PolyMathOrg/PolyMath';
baseline: 'PolyMath';
load.
Metacello new
baseline:'Seaside3';
repository: 'github://SeasideSt/Seaside:master/repository';
load.
Metacello new
baseline: 'PetitParser2';
repository: 'github://kursjan/petitparser2';
load.
Metacello new
baseline: 'Moose';
repository: 'github://moosetechnology/Moose:development/src';
load.
]
In a default image this takes around 681086ms. With the above change it takes 473210ms. So a lot faster!
If I run RPackageOrganizer default packages sumNumbers: #linesOfCode I get 1137393 lines of code in the default image and 1137394 in the one with the change. Not sure why the 1 line of code difference, but it's in the Monticello package.
The method
MCPackageLoader>>#basicLoadDefinitions
loads classes twice. This is mentioned in its comment. However, the fact that classes is loaded twice leads to a significant slowdown especially in code that uses traits.The screenshot above shows a profiler on loading GT.
loadClassDefinition:
which is the first pass to load classes and traits takes 7.3% of the time. ThentryToLoad:
which should load methods also loads again classes. This time loading the same class definitions as before takes 30% of the time!!!If we expand we see that most time is spend in the
TraitBuilderEnhancher
. For example when migrating class instancesBehaviour class >>#allInstances
is now called a lot, taking a significant amount of time.I'm not sure if there are any side-effects but loading also class definitions while loading method definitions should not be necessary. One maybe naive solution is to have
tryToLoad:
as below. It does not attempt to load again class definitions.I tried the above solution on loading the following code in a Pharo 9 image:
In a default image this takes around 681086ms. With the above change it takes 473210ms. So a lot faster!
If I run
RPackageOrganizer default packages sumNumbers: #linesOfCode
I get 1137393 lines of code in the default image and 1137394 in the one with the change. Not sure why the 1 line of code difference, but it's in the Monticello package.The text was updated successfully, but these errors were encountered: