Hi, this is another min/max change: inlining logic in cps/types.scm.
I did this just because I stumbled over it and when I benchmarked with the r7rs benchmarks, I saw that this brings a 1-2% speedup for cat, gcbench, and quicksort. Best wishes, Arne From b18bc284ed916482f27d89d3123f8c0c28b38a8e Mon Sep 17 00:00:00 2001 From: Arne Babenhauserheide <[email protected]> Date: Thu, 8 Oct 2026 21:46:47 +0200 Subject: [PATCH] cps: inline min and max three elements deep to reduce indirect calls * module/language/cps/types.scm (min): inline < three levels deep * module/language/cps/types.scm (max): inline > three levels deep --- module/language/cps/types.scm | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/module/language/cps/types.scm b/module/language/cps/types.scm index fbe7ae087..88ddf732b 100644 --- a/module/language/cps/types.scm +++ b/module/language/cps/types.scm @@ -218,13 +218,13 @@ (define min (case-lambda ((a b) (if (< a b) a b)) - ((a b c) (min (min a b) c)) - ((a b c d) (min (min a b) c d)))) + ((a b c) (if (< a b) (if (< b c) a (if (< a c) a c)) (if (< b c) b c))) + ((a b c d) (min (min a b c) d)))) (define max (case-lambda ((a b) (if (> a b) a b)) - ((a b c) (max (max a b) c)) - ((a b c d) (max (max a b) c d)))) + ((a b c) (if (> a b) (if (> b c) a (if (> a c) a c)) (if (> b c) b c))) + ((a b c d) (max (max a b c) d)))) -- 2.54.0 -- Unpolitisch sein heißt politisch sein, ohne es zu merken. https://www.draketo.de
signature.asc
Description: PGP signature
