[squeak-dev] News from SimulationStudio

christoph.thiede at student.hpi.uni-potsdam.de christoph.thiede at student.hpi.uni-potsdam.de
Sun Nov 14 01:16:43 UTC 2021

Hi all!

Just a short note on some recent updates to SimulationStudio [1]: As of today, there is a new Simulator class that you can inherit from to create different combinable extensions to the default execution behavior (using the Chain of Responsibility pattern). The existing SimulationContext subclasses have been updated to use the new protocol, and I also added two brand-new helpful simulators, LimitSimulator and BenchmarkSimulator.

Both these simulators aim to abstract execution complexity from real runtime and allow you to define execution constraints that are invariant from the performance of the VM or the local machine. LimitSimulator is the time-abstracted equivalent to #valueWithin:onTimeout: to abort execution after a specified number of bytecode steps. BenchmarkSimulator is similar to #timeToRun, you can measure the number of bytecode steps and also the number of executed primitives for an arbitrary block. My main use case of BenchmarkSimulator is more reliable, reproducible of comparison of microbenchmarks. For example, when I am optimizing a collection function, I do not any longer need to #bench again and again until I have reached a satisfying precision, and if my laptop is working slower the other day because I unpluuged the charger, the benchmark results will still be the same, and when Levente is reviewing my patch, the benchmarks results will still be exactly the same on his machine.

Try it out yourself!

	BenchmarkSimulator browseRecord: [(1 to: 5) do: [:i | i ** i]].
	BenchmarkSimulator browseRecord: [1 to: 5 do: [:i | i ** i]].

Or for the execution "step-outs":

    | dict |
    dict := Dictionary new
        at: 1 put: #one;
    LimitSimulator new
        stepLimit: 139;
                at: 1 ifAbsentPut: ['One'];
                at: 2 ifAbsentPut: ['Two']].
    "Can you get this test passed? It is possible :-)"


    Metacello new
        baseline: 'SimulationStudio';
        githubUser: 'LinqLover' project: 'SimulationStudio' path: 'packages';

Have a nice weekend & Carpe Squeak! :-)


PS: Stay tuned - further simulation fun is planned to arrive during the coming months! :-)

[1] https://github.com/LinqLover/SimulationStudio

Sent from Squeak Inbox Talk
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20211114/68626e39/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: BenchmarkSimulator.png
Type: application/octet-stream
Size: 58726 bytes
Desc: not available
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20211114/68626e39/attachment.obj>

More information about the Squeak-dev mailing list