From e1304cecd625f4fea2967505cb4c64f7032b6507 Mon Sep 17 00:00:00 2001 From: Stefan Marr Date: Tue, 26 Mar 2024 14:02:24 +0000 Subject: [PATCH] Add microbenchmark for trivial message send Signed-off-by: Stefan Marr --- .../LanguageFeatures/LoopTrivialDispatch.som | 78 +++++++++++++++++++ 1 file changed, 78 insertions(+) create mode 100644 Examples/Benchmarks/LanguageFeatures/LoopTrivialDispatch.som diff --git a/Examples/Benchmarks/LanguageFeatures/LoopTrivialDispatch.som b/Examples/Benchmarks/LanguageFeatures/LoopTrivialDispatch.som new file mode 100644 index 00000000..703dcd8e --- /dev/null +++ b/Examples/Benchmarks/LanguageFeatures/LoopTrivialDispatch.som @@ -0,0 +1,78 @@ +" +Copyright (c) 2024 see AUTHORS file + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the 'Software'), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +" + +"Microbenchmark: measure dispatch of a trivial method in inlined loop" +LoopTrivialDispatch = Benchmark ( + trivial = ( ^ 1 ) + + benchmark = ( | counter iter | + counter := 0. + iter := 20000. + + [ iter > 0 ] whileTrue: [ + iter := iter - 1. + self trivial. + self trivial. + self trivial. + self trivial. + self trivial. + + self trivial. + self trivial. + self trivial. + self trivial. + self trivial. + + self trivial. + self trivial. + self trivial. + self trivial. + self trivial. + + self trivial. + self trivial. + self trivial. + self trivial. + self trivial. + + self trivial. + self trivial. + self trivial. + self trivial. + self trivial. + + self trivial. + self trivial. + self trivial. + self trivial. + self trivial. + + ]. + + ^ counter + ) + + verifyResult: result = ( + ^ 0 = result + ) + +)