Skip to content
Draft
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
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ tests
testSerializationAndMaterializationOfAllSamples
"Tests that the result of serialization and materialization of every sample does not raise an error and that it has the expected size. Would be nice to check if the result is equal but many classes do not have = well defined for us."

FLSampleFactory allSamples
FLSampleFactory "allSamples" allNonMetalevelSamples
do: [ :aSample | self testSample: aSample ]
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@
"instvars" : [ ],
"name" : "FLBenchmarkSampleTest",
"type" : "normal"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@
"instvars" : [ ],
"name" : "FLSampleFactoryTest",
"type" : "normal"
}
}
Original file line number Diff line number Diff line change
@@ -1 +1 @@
SystemOrganization addCategory: #'Fuel-Benchmarks-Tests'!
self packageOrganizer ensurePackage: #'Fuel-Benchmarks-Tests' withTags: #()!
Original file line number Diff line number Diff line change
@@ -1 +1 @@
(name 'Fuel-Benchmarks-Tests')
(name 'Fuel-Benchmarks-Tests')

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,7 @@ printOn: aStream
super printOn: aStream.
aStream
nextPutAll: ' title: ';
print: title
print: title.
aStream
nextPutAll: ' problemSize: ';
print: problemSize
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
accessing
problemSize: aNumber

problemSize := aNumber
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
accessing
problemSize

^ problemSize
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
"classvars" : [ ],
"instvars" : [
"content",
"title"
"title",
"problemSize"
],
"name" : "FLBenchmarkSample",
"type" : "normal"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
samples
dateAndTimes

| initialTime initialDate |
initialTime := Time fromSeconds: 76020.
| initialDate |
initialDate := Date fromSeconds: 3492288000.
^ (1 to: self problemSize)
collect: [:index |
DateAndTime
date: (initialDate subtractDays: index)
time: (initialTime addSeconds: index) ].
^ (1 to: self problemSize) collect: [:index |
DateAndTime
date: (initialDate subtractDays: index)
time: (Time fromSeconds: index \\ (60*60*24)) ].
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
samples
times

| initialTime |
initialTime := Time fromSeconds: 76020.
^ (1 to: self problemSize)
collect: [ :index | initialTime addSeconds: index ].
^ (1 to: self problemSize) collect: [ :index |
Time seconds: index \\ (60*60*24) nanoSeconds: index ]
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ samples
compiledMethods

| methods |
methods := self fewSystemClasses inject: Array new into: [ :array :aClass | array, aClass methods ].

^ (1 to: self problemSize)
collect: [ :i | (methods atWrap: i) copy ]
methods := self fewSystemClasses
flatCollect: [ :each | each methods reject: #isNamedPrimitive ]
as: Array.

^ (1 to: self problemSize) collect: [ :i | (methods atWrap: i) copy ]
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,5 @@ methodDictionaries

| methodDicts |
methodDicts := self fewSystemClasses collect: [ :aClass | aClass methodDict ].
^ (1 to: self problemSize)
collect: [ :i | (methodDicts atWrap: i) copy ]


^ (1 to: self problemSize) collect: [ :i | (methodDicts atWrap: i) copy ]
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
examples
exampleBenchSerialization

| samples runner |
{ 50. 500. 5000. 50000. "500000" } do: [ :problemSize |
samples := Array streamContents: [ :stream |
{
FLNumberSampleFactory. #smallIntegers.
FLStructureSampleFactory. #completeGraph.
FLStructureSampleFactory. #regularGraphOfFixedDegree.
FLCommonSampleFactory. #points.
FLNumberSampleFactory. #floats.
} pairsDo: [ :a :b |
stream nextPut: (a sampleNamed: b problemSize: problemSize) ] ].

runner := SMarkCogRunner new.
runner iterations: 3.
runner problemSize: problemSize.

samples do: [ :each |
| suite |
"ScriptConsole << 'ProblemSize: '; print: each problemSize."
suite :=
FLSMarkSuite new
runOnly: #benchSerialization;
sample: each;
runner: runner;
yourself.

runner suite: suite; execute ].

runner reportConfiguration: ScriptConsole; report.
ScriptConsole cr; flush ]
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
sample creation
sampleNamed: aSelector

^ (self new selector: aSelector) asSample
^ (self new
selector: aSelector;
yourself) asSample
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
sample creation
sampleNamed: aSelector problemSize: n

^ (self new
selector: aSelector;
problemSize: n;
yourself) asSample
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
sample creation
samplesNamed: aCollectionOfSampleSelectors
"Answer a collection of instances of me, with the selectors. Each selector should define a class-side method."
^aCollectionOfSampleSelectors
collect: [ :aSelector |
(self withAllSubclasses detect: [:each | each includesSelector: aSelector ])
sampleNamed: aSelector ]
"Answer a collection of instances of me, with the selectors. Each selector should define a class-side method."

^ self samplesNamed: aCollectionOfSampleSelectors problemSize: self defaultProblemSize
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
sample creation
samplesNamed: aCollectionOfSampleSelectors problemSize: n
"Answer a collection of instances of me, with the selectors. Each selector should define a class-side method."

^ aCollectionOfSampleSelectors collect: [ :aSelector |
self sampleNamed: aSelector problemSize: n ]
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
sample creation
samplesProblemSize: n

^ self samplesNamed: self sampleSelectors problemSize: n
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
building
asSample

^ FLBenchmarkSample
title: selector asString
content: (self perform: selector)
^ FLBenchmarkSample new
title: selector asString;
problemSize: problemSize;
content: (self perform: selector);
yourself
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
private
fewSystemClasses
^ Array streamContents: [ :stream |
#('System' 'Collections' 'SUnit') do: [ :packageName |
(SystemOrganization categoriesMatching: packageName, '*') do: [ :category |
stream nextPutAll: (SystemOrganization classesInCategory: category) ] ] ]

^ (PackageOrganizer default packages
select: [ :each |
#( 'System' 'Collections' 'SUnit' )
anySatisfy: [ :prefix | each name beginsWith: prefix ] ])
flatCollect: [ :each | each classes ] as: Array
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
accessing
problemSize: anObject
problemSize := anObject
problemSize: anInteger
problemSize := anInteger
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
accessing
selector: anObject
selector := anObject
selector: aSymbol
selector := aSymbol
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
samples
completeGraph
"Answe ra complete graph of aproximately problemSize edges. A complete graph of n vertices has n*(n-1)/2 edges."
"Answer a complete graph of aproximately problemSize edges. A complete graph of n vertices has n*(n-1)/2 edges."

| n vertices |
n := (self problemSize * 2) sqrt rounded.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
samples
globals

| globals |
globals := FLConfiguration defaultGlobalSymbols collect: [ :s |
self class environment at: s ].
| globals |
globals := Array streamContents: [ :stream |
FLConfiguration defaultGlobalSymbols do: [ :each |
self class environment
at: each
ifPresent: [ :value | stream nextPut: value ] ] ].

^ (1 to: self problemSize) collect: [ :i |
globals atWrap: i ].
^ (1 to: self problemSize) collect: [ :i | globals atWrap: i ]
Original file line number Diff line number Diff line change
@@ -1,4 +1 @@
SystemOrganization addCategory: #'Fuel-Benchmarks'!
SystemOrganization addCategory: #'Fuel-Benchmarks-Core'!
SystemOrganization addCategory: #'Fuel-Benchmarks-Other'!
SystemOrganization addCategory: #'Fuel-Benchmarks-Samples'!
self packageOrganizer ensurePackage: #'Fuel-Benchmarks' withTags: #(#Core #Other #Samples)!
Loading