[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
scratch/elisp-benchmarks d0963279fec 16/54: * benchmarks/map-closure.el:
From: |
Pip Cet |
Subject: |
scratch/elisp-benchmarks d0963279fec 16/54: * benchmarks/map-closure.el: Add new u-benchmark. |
Date: |
Mon, 30 Dec 2024 22:40:41 -0500 (EST) |
branch: scratch/elisp-benchmarks
commit d0963279fec4274ec4d780a3f802416a43138b12
Author: Andrea Corallo <akrl@sdf.org>
Commit: Andrea Corallo <akrl@sdf.org>
* benchmarks/map-closure.el: Add new u-benchmark.
---
elisp-benchmarks/benchmarks/map-closure.el | 44 ++++++++++++++++++++++++++++++
1 file changed, 44 insertions(+)
diff --git a/elisp-benchmarks/benchmarks/map-closure.el
b/elisp-benchmarks/benchmarks/map-closure.el
new file mode 100644
index 00000000000..30fed05cc26
--- /dev/null
+++ b/elisp-benchmarks/benchmarks/map-closure.el
@@ -0,0 +1,44 @@
+;; -*- lexical-binding: t; -*-
+
+;; Copyright (C) 2020 Free Software Foundation, Inc.
+
+;; This file is part of GNU Emacs.
+
+;; GNU Emacs is free software: you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; GNU Emacs is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
+
+;;; Commentary:
+
+;; Apply a local function capturing a variable into a closure on each
+;; element of list.
+
+(require 'cl-lib)
+
+(defvar elb-map-closure-len 50000)
+(defvar elb-map-closure-list
+ (mapcar #'random (make-list elb-map-closure-len 1000)))
+
+(defun elb-map-closure (l)
+ (let ((captured 0))
+ (mapc (lambda (x)
+ (when (or (> x 750)
+ (< x 250))
+ (cl-incf captured)))
+ l)
+ captured))
+
+(defun elb-map-closure-entry ()
+ (cl-loop repeat 2500
+ do (elb-map-closure elb-map-closure-list)))
+
+(provide 'elb-map-closure)
- branch scratch/elisp-benchmarks created (now b4b10726cda), Pip Cet, 2024/12/30
- scratch/elisp-benchmarks 28e2d369c9e 04/54: Reduce test setup + increase `elb-listlen-tc-len' lenght, Pip Cet, 2024/12/30
- scratch/elisp-benchmarks e0762e1f175 11/54: * elisp-benchmarks.el (elisp-benchmarks-run): Recompile by default., Pip Cet, 2024/12/30
- scratch/elisp-benchmarks b64855f83f0 03/54: * elisp-benchmarks.el: Fix Author/maintainer info, Pip Cet, 2024/12/30
- scratch/elisp-benchmarks 7b0d2d4f16e 06/54: Increment version number, Pip Cet, 2024/12/30
- scratch/elisp-benchmarks 7d2b7516a29 08/54: * benchmarks/dhrystone.el: New benchmark, Pip Cet, 2024/12/30
- scratch/elisp-benchmarks 2981efb7b57 07/54: * benchmarks/nbody.el: New benchmark, Pip Cet, 2024/12/30
- scratch/elisp-benchmarks 350b95f6082 10/54: * elisp-benchmarks.el: Typo fix, Pip Cet, 2024/12/30
- scratch/elisp-benchmarks d0963279fec 16/54: * benchmarks/map-closure.el: Add new u-benchmark.,
Pip Cet <=
- scratch/elisp-benchmarks 69a99de283a 20/54: Add new 'inclist-type-hints' benchmark + tag new version, Pip Cet, 2024/12/30
- scratch/elisp-benchmarks a29db7b9366 18/54: * Update for new native-comp API + tag new version, Pip Cet, 2024/12/30
- scratch/elisp-benchmarks 7b4f68f6866 17/54: ; * elisp-benchmarks.el: Tag new version and update copyright., Pip Cet, 2024/12/30
- scratch/elisp-benchmarks c5680501af1 24/54: Allow for GC to kick in pidigit, Pip Cet, 2024/12/30
- scratch/elisp-benchmarks dd2ba559d66 27/54: * elisp-benchmarks.el (elb-runs): Fix group., Pip Cet, 2024/12/30
- scratch/elisp-benchmarks e372bd14f52 38/54: Make it usable on Emacs-27, Pip Cet, 2024/12/30
- scratch/elisp-benchmarks eb485e9acf3 25/54: Revert "Make `comp-speed' explicit in each benchmark", Pip Cet, 2024/12/30
- scratch/elisp-benchmarks c9be2a398f5 14/54: * elisp-benchmarks.el (elisp-benchmarks-run): Minor, better regexp., Pip Cet, 2024/12/30
- scratch/elisp-benchmarks bec6f1ea802 13/54: * benchmarks/flet.el: Add new u-benchmark., Pip Cet, 2024/12/30
- scratch/elisp-benchmarks 99b6355dd4b 01/54: New package initial add, Pip Cet, 2024/12/30