Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactoring benchmarks #10

Merged
merged 24 commits into from
Jan 15, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions scripts/runAllBenchs.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/bash

set -x
set -e

SCRIPT_DIR=$(realpath "$(dirname ${BASH_SOURCE[0]})")

PHARO_VERSION=130 VERSION_TO_LOAD=dev ${SCRIPT_DIR}/runBenchmarksInPharo.sh
PHARO_VERSION=120 VERSION_TO_LOAD=dev ${SCRIPT_DIR}/runBenchmarksInPharo.sh
PHARO_VERSION=110 VERSION_TO_LOAD=dev ${SCRIPT_DIR}/runBenchmarksInPharo.sh
45 changes: 45 additions & 0 deletions scripts/runBenchmarksInPharo.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
#!/bin/bash

set -x
set -e

ROOT_DIR=$(pwd)
: "${PHARO_VERSION:=130}"
: "${VERSION_TO_LOAD:=dev}"
: "${DATE:=$(date +%Y-%m-%d)}"

mkdir -p benchmarks/$PHARO_VERSION/$DATE/image

pushd benchmarks/$PHARO_VERSION/$DATE
pushd image

wget -O - get.pharo.org/64/$PHARO_VERSION+vm | bash

./pharo Pharo.image eval --save \
"Metacello new \
baseline: 'BlocBenchs'; \
repository: 'tonel://$ROOT_DIR/src'; \
load"

# We load the requested version of the packages
./pharo Pharo.image eval --save \
"{ \
'alexandrie'. \
'bloc'. \
'album'. \
'toplo'. \
'spec-toplo'. \
} do: [ :repoName | \
(IceRepository registry \
select: [ :each | each name asLowercase = repoName ]) \
do:[ :each | \
(each branchNamed: '$VERSION_TO_LOAD') checkout. \
each fetch; pull ] ] \
displayingProgress: [ :each | each ]. \
"

./pharo-ui Pharo.image eval "BlBCase runAllWithResultsIn: FileLocator imageDirectory / '..' / 'results'. Smalltalk snapshot:false andQuit: true."

popd
rm -rf image
popd
15 changes: 12 additions & 3 deletions src/BaselineOfBlocBenchs/BaselineOfBlocBenchs.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ BaselineOfBlocBenchs >> baseline: spec [
for: #common
do: [
self
"declareBlocOn: spec;"
declareBlocOn: spec;
declareBoidsOn: spec;
declareToploOn: spec;
declareFFICallLoggerOn: spec;
Expand All @@ -31,8 +31,17 @@ BaselineOfBlocBenchs >> baseline: spec [
package: 'BlocBenchs-Alexandrie'
with: [ spec requires: #('Toplo' 'BlocBenchs-Printing' 'BlocBenchs-FPS') ];
package: 'BlocBenchs-Tests'
with: [ spec requires: #('BlocBenchs-SDL' 'BlocBenchs-Alexandrie' 'BlocBenchs-Old' 'BlocBenchs-FPS') ]
]
with: [ spec requires: #('BlocBenchs-SDL' 'BlocBenchs-Alexandrie' 'BlocBenchs-Old' 'BlocBenchs-FPS') ];
package: 'BlocBenchs-Core'
with: [ spec requires: #('Bloc' 'BlocBenchs-FPS' 'FFICallLogger' 'SaucoPerfMeter' 'SDLExperiments') ];
package: 'BlocBenchs-Benchs'
with: [ spec requires: #('Toplo' 'BlocBenchs-Core' 'BlocTutorialsBoids') ]
].

spec for: #'pharo11.x'
do: [
spec package: 'BlocBenchs-Compatibility-P11'.
]
]

{ #category : #'external projects' }
Expand Down
46 changes: 46 additions & 0 deletions src/BlocBenchs-Benchs/BlBAbstractCircleCase.class.st
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
Class {
#name : #BlBAbstractCircleCase,
#superclass : #BlBAbstractTranslatingFiguresCase,
#category : #'BlocBenchs-Benchs-Bloc'
}

{ #category : #running }
BlBAbstractCircleCase class >> isAbstract [

^ self == BlBAbstractCircleCase
]

{ #category : #hook }
BlBAbstractCircleCase >> newFigureWith: random [

^ BlElement new
geometry: BlCircleGeometry new;
size: self radius * 2;
in:[ :me | self prepare: me with: random ];
yourself

]

{ #category : #accessing }
BlBAbstractCircleCase >> numberOfFigures [

^ 100
]

{ #category : #accessing }
BlBAbstractCircleCase >> offsetBetweenFigures [

^ 6 @ 0
]

{ #category : #hook }
BlBAbstractCircleCase >> prepare: anElement with: random [

^ self subclassResponsibility
]

{ #category : #accessing }
BlBAbstractCircleCase >> radius [

^ 50.0 asPoint
]
68 changes: 68 additions & 0 deletions src/BlocBenchs-Benchs/BlBAbstractGradientCirclesCase.class.st
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
Class {
#name : #BlBAbstractGradientCirclesCase,
#superclass : #BlBAbstractCircleCase,
#instVars : [
'numberOfStops'
],
#category : #'BlocBenchs-Benchs-Bloc'
}

{ #category : #running }
BlBAbstractGradientCirclesCase class >> benchMatrix [

^ super benchMatrix
forSelector: #numberOfStops addOptions: #(2 3 5)
]

{ #category : #running }
BlBAbstractGradientCirclesCase class >> isAbstract [

^ self == BlBAbstractGradientCirclesCase
]

{ #category : #accessing }
BlBAbstractGradientCirclesCase >> defaultLabel [

^ '{1} w/ {2} stops' format: {
super defaultLabel.
numberOfStops }
]

{ #category : #hook }
BlBAbstractGradientCirclesCase >> initialize [

super initialize.

numberOfStops := 3.
]

{ #category : #hook }
BlBAbstractGradientCirclesCase >> newGradient: random [

^ self subclassResponsibility
]

{ #category : #hook }
BlBAbstractGradientCirclesCase >> newStops: random [

^ (0.0 to: 1.0 by: 1 / (numberOfStops - 1)) collect: [ :each |
each -> (Color random: random) ]
]

{ #category : #accessing }
BlBAbstractGradientCirclesCase >> numberOfStops [

^ numberOfStops
]

{ #category : #accessing }
BlBAbstractGradientCirclesCase >> numberOfStops: anInteger [

numberOfStops := anInteger
]

{ #category : #hook }
BlBAbstractGradientCirclesCase >> prepare: anElement with: random [

anElement background: (self newGradient: random)
]
35 changes: 35 additions & 0 deletions src/BlocBenchs-Benchs/BlBAbstractImagesCase.class.st
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
Class {
#name : #BlBAbstractImagesCase,
#superclass : #BlBAbstractTranslatingFiguresCase,
#traits : 'TBlBAbstractImagesLogic',
#classTraits : 'TBlBAbstractImagesLogic classTrait',
#category : #'BlocBenchs-Benchs-Bloc'
}

{ #category : #running }
BlBAbstractImagesCase class >> isAbstract [

^ self == BlBAbstractImagesCase
]

{ #category : #hook }
BlBAbstractImagesCase >> newFigureWith: random [

| container |
container := BlElement new.
container clipChildren: false.

1 to: self numberOfRows do:[ :index |
container addChild:
((self newImageElementWith: random)
position: 0 @ (index * self offsetBetweenFigures y);
yourself) ].

^ container
]

{ #category : #hook }
BlBAbstractImagesCase >> newImageElementWith: random [

^ self subclassResponsibility
]
31 changes: 31 additions & 0 deletions src/BlocBenchs-Benchs/BlBAbstractSimpleAnimationCase.class.st
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
"
I'm a profiling case with an animated BlElement.
"
Class {
#name : #BlBAbstractSimpleAnimationCase,
#superclass : #BlBBlocCase,
#category : #'BlocBenchs-Benchs-Bloc'
}

{ #category : #running }
BlBAbstractSimpleAnimationCase class >> isAbstract [

^ self == BlBAbstractSimpleAnimationCase
]

{ #category : #hooks }
BlBAbstractSimpleAnimationCase >> newElement [

^ BlElement new
position: 100 asPoint;
size: 100 asPoint;
border: (BlBorder paint: Color gray width: 4);
addAnimation: (self newSteppingAnimation);
yourself
]

{ #category : #'instance creation' }
BlBAbstractSimpleAnimationCase >> newSteppingAnimation [

^ self subclassResponsibility
]
80 changes: 80 additions & 0 deletions src/BlocBenchs-Benchs/BlBAbstractTextEditorCase.class.st
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
"
I'm a profiling case where a text editor is scrolled down multiple times.
"
Class {
#name : #BlBAbstractTextEditorCase,
#superclass : #BlBBlocCase,
#instVars : [
'editorElement',
'lapseToWaitBetween',
'numberOfSimulatedEvents'
],
#category : #'BlocBenchs-Benchs-Bloc'
}

{ #category : #running }
BlBAbstractTextEditorCase class >> isAbstract [

^ self == BlBAbstractTextEditorCase
]

{ #category : #accessing }
BlBAbstractTextEditorCase >> defaultLapseToWait [

^ 0.5 seconds
]

{ #category : #accessing }
BlBAbstractTextEditorCase >> defaultNumberOfSimulatedEvents [

^ 15
]

{ #category : #hooks }
BlBAbstractTextEditorCase >> dispatchEvent [

self subclassResponsibility
]

{ #category : #accessing }
BlBAbstractTextEditorCase >> lapseToWaitBetween [

^ lapseToWaitBetween ifNil: [ lapseToWaitBetween := self defaultLapseToWait ]
]

{ #category : #accessing }
BlBAbstractTextEditorCase >> lapseToWaitBetween: aDuration [

lapseToWaitBetween := aDuration
]

{ #category : #hooks }
BlBAbstractTextEditorCase >> newElement [

^ editorElement := ToAlbum new
text: (String loremIpsum: 20000) asRopedText;
withRowNumbers;
enqueueTask: (BlRepeatedTaskAction new
delay: self lapseToWaitBetween;
action: [ self dispatchEvent ]);
yourself
]

{ #category : #accessing }
BlBAbstractTextEditorCase >> numberOfSimulatedEvents [

^ numberOfSimulatedEvents ifNil: [
numberOfSimulatedEvents := self defaultNumberOfSimulatedEvents ]
]

{ #category : #accessing }
BlBAbstractTextEditorCase >> numberOfSimulatedEvents: anInteger [

numberOfSimulatedEvents := anInteger
]

{ #category : #hooks }
BlBAbstractTextEditorCase >> spaceExtent [

^ 500 @ 900
]
Loading
Loading