[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/elisp-benchmarks 72ad57a 2/2: Add new 'inclist-type-hin
From: |
Andrea Corallo |
Subject: |
[elpa] externals/elisp-benchmarks 72ad57a 2/2: Add new 'inclist-type-hints' benchmark + tag new version |
Date: |
Mon, 14 Sep 2020 17:35:10 -0400 (EDT) |
branch: externals/elisp-benchmarks
commit 72ad57a33df403ccd493f445115e4f7833cdc915
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.
---
benchmarks/inclist-type-hints.el | 44 ++++++++++++++++++++++++++++++++++++++++
elisp-benchmarks.el | 2 +-
2 files changed, 45 insertions(+), 1 deletion(-)
diff --git a/benchmarks/inclist-type-hints.el b/benchmarks/inclist-type-hints.el
new file mode 100644
index 0000000..660f4e4
--- /dev/null
+++ b/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.el b/elisp-benchmarks.el
index 4ae4eca..326ff73 100644
--- a/elisp-benchmarks.el
+++ b/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