emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

scratch/elisp-benchmarks 69a99de283a 20/54: Add new 'inclist-type-hints'


From: Pip Cet
Subject: scratch/elisp-benchmarks 69a99de283a 20/54: Add new 'inclist-type-hints' benchmark + tag new version
Date: Mon, 30 Dec 2024 22:40:41 -0500 (EST)

branch: scratch/elisp-benchmarks
commit 69a99de283a8faad96c5aa768a1aa922fa372dec
Author: Andrea Corallo <akrl@sdf.org>
Commit: Andrea Corallo <akrl@sdf.org>

    Add new 'inclist-type-hints' benchmark + tag new version
    
            * elisp-benchmarks.el: Tag new version.
    
            * benchmarks/inclist-type-hints.el: New benchmark, same as
            inclist.el but making use of compiler type hints.
---
 elisp-benchmarks/benchmarks/inclist-type-hints.el | 44 +++++++++++++++++++++++
 elisp-benchmarks/elisp-benchmarks.el              |  2 +-
 2 files changed, 45 insertions(+), 1 deletion(-)

diff --git a/elisp-benchmarks/benchmarks/inclist-type-hints.el 
b/elisp-benchmarks/benchmarks/inclist-type-hints.el
new file mode 100644
index 00000000000..660f4e44ecf
--- /dev/null
+++ b/elisp-benchmarks/benchmarks/inclist-type-hints.el
@@ -0,0 +1,44 @@
+;;; bench/inclist-type-hints.el --- Exercise type hints -*- 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:
+
+;; Iteratively increment the elements of a list. Same as inclist.el
+;; but make use of compiler type hints.
+
+;;; Code:
+
+(require 'cl-lib)
+
+(defvar elb-inclist-th-no-type-hints-len 50000)
+(defvar elb-inclist-th-no-type-hints-list
+  (mapcar #'random (make-list elb-inclist-th-no-type-hints-len 100)))
+
+(defun elb-inclist-th (l)
+  (declare (cl-optimize (speed 3) (safety 0)))
+  (prog1 l
+    (while l
+      (let ((c (cl-the cons l)))
+       (cl-incf (cl-the fixnum (car c)))
+       (setq l (cdr c))))))
+
+(defun elb-inclist-type-hints-entry ()
+  (let ((l (copy-sequence elb-inclist-th-no-type-hints-list)))
+    (cl-loop repeat 10000
+            do (elb-inclist-th l))))
diff --git a/elisp-benchmarks/elisp-benchmarks.el 
b/elisp-benchmarks/elisp-benchmarks.el
index 4ae4eca849c..326ff732ee5 100644
--- a/elisp-benchmarks/elisp-benchmarks.el
+++ b/elisp-benchmarks/elisp-benchmarks.el
@@ -4,7 +4,7 @@
 
 ;; Author: Andrea Corallo <akrl@sdf.org>
 ;; Maintainer: Andrea Corallo <akrl@sdf.org>
-;; Version: 1.7
+;; Version: 1.8
 ;; Keywords: languages, lisp
 ;; Package-Type: multi
 ;; Created: 2019-01-12



reply via email to

[Prev in Thread] Current Thread [Next in Thread]