summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGemini Lasswell <gazally@runbox.com>2018-11-23 12:36:32 -0800
committerGemini Lasswell <gazally@runbox.com>2018-11-25 12:31:24 -0800
commite2b5f51785f5aae837c0c876237acf56bae8c674 (patch)
treebce6541d38ec2862f53a6eaf1aa41a389d317d6d
parent52c7cc8621593dc9231ed8e84796d11b55e77dec (diff)
downloademacs-e2b5f51785f5aae837c0c876237acf56bae8c674.tar.gz
Create benchmark directory and add some benchmark tasks
* benchmark/lisp/cus-theme-tasks.el: * benchmark/lisp/emacs-lisp/bytecomp-tasks.el: * benchmark/lisp/kmacro-tasks.el: * benchmark/lisp/textmodes/fill-tasks.el: * benchmark/src/cmds-tasks.el: * benchmark/src/data-tasks.el: * benchmark/src/emacs-tasks.el: * benchmark/src/syntax-tasks.el: New files.
-rw-r--r--benchmark/lisp/cus-theme-tasks.el30
-rw-r--r--benchmark/lisp/emacs-lisp/bytecomp-tasks.el100
-rw-r--r--benchmark/lisp/kmacro-tasks.el44
-rw-r--r--benchmark/lisp/textmodes/fill-tasks.el38
-rw-r--r--benchmark/src/cmds-tasks.el40
-rw-r--r--benchmark/src/data-tasks.el40
-rw-r--r--benchmark/src/emacs-tasks.el29
-rw-r--r--benchmark/src/syntax-tasks.el50
8 files changed, 371 insertions, 0 deletions
diff --git a/benchmark/lisp/cus-theme-tasks.el b/benchmark/lisp/cus-theme-tasks.el
new file mode 100644
index 00000000000..83030abb2bd
--- /dev/null
+++ b/benchmark/lisp/cus-theme-tasks.el
@@ -0,0 +1,30 @@
+;;; cus-theme-tasks.el --- Custom Themes -*- lexical-binding: t; -*-
+
+;; Copyright (C) 2018 Free Software Foundation, Inc.
+
+;; Author: Gemini Lasswell <gazally@runbox.com>
+
+;; This program 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.
+
+;; This program 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 this program. If not, see <https://www.gnu.org/licenses/>.
+
+;;; Code:
+
+(require 'erb-task)
+
+(erb-deftask cus-theme-tasks-load-tango ()
+ "Load the tango theme."
+ (:version "1.0" :special own-process)
+ (erb-task-time (load-theme 'tango)))
+
+(provide 'cus-theme-tasks)
+;;; cus-theme-tasks.el ends here
diff --git a/benchmark/lisp/emacs-lisp/bytecomp-tasks.el b/benchmark/lisp/emacs-lisp/bytecomp-tasks.el
new file mode 100644
index 00000000000..69d952a2345
--- /dev/null
+++ b/benchmark/lisp/emacs-lisp/bytecomp-tasks.el
@@ -0,0 +1,100 @@
+ ;;; bytecomp-tasks.el --- Byte Compilation -*- lexical-binding: t; -*-
+
+;; Copyright (C) 2018 Free Software Foundation, Inc.
+
+;; Author: Gemini Lasswell <gazally@runbox.com>
+
+;; This program 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.
+
+;; This program 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 this program. If not, see <https://www.gnu.org/licenses/>.
+
+;;; Code:
+
+(require 'erb-task)
+(require 'bytecomp)
+
+(defvar bytecomp-tasks-doctor-doc
+ '(defun doctor-doc ()
+ (cond
+ ((equal doctor-sent '(foo))
+ (doctor-type '(bar! (doc$ doctor--please) (doc$ doctor--continue) \.)))
+ ((member doctor-sent doctor--howareyoulst)
+ (doctor-type '(i\'m ok \. (doc$ doctor--describe) yourself \.)))
+ ((or (member doctor-sent '((good bye) (see you later) (i quit) (so long)
+ (go away) (get lost)))
+ (memq (car doctor-sent)
+ '(bye halt break quit done exit goodbye
+ bye\, stop pause goodbye\, stop pause)))
+ (doctor-type (doc$ doctor--bye)))
+ ((and (eq (car doctor-sent) 'you)
+ (memq (cadr doctor-sent) doctor--abusewords))
+ (setq doctor-found (cadr doctor-sent))
+ (doctor-type (doc$ doctor--abuselst)))
+ ((eq (car doctor-sent) 'whatmeans)
+ (doctor-def (cadr doctor-sent)))
+ ((equal doctor-sent '(parse))
+ (doctor-type (list 'subj '= doctor-subj ", "
+ 'verb '= doctor-verb "\n"
+ 'object 'phrase '= doctor-obj ","
+ 'noun 'form '= doctor-object "\n"
+ 'current 'keyword 'is doctor-found
+ ", "
+ 'most 'recent 'possessive
+ 'is doctor-owner "\n"
+ 'sentence 'used 'was
+ "..."
+ '(doc// doctor--bak))))
+ ((memq (car doctor-sent) '(are is do has have how when where who why))
+ (doctor-type (doc$ doctor--qlist)))
+ ;; ((eq (car sent) 'forget)
+ ;; (set (cadr sent) nil)
+ ;; (doctor-type '((doc$ doctor--isee) (doc$ doctor--please)
+ ;; (doc$ doctor--continue)\.)))
+ (t
+ (if (doctor-defq doctor-sent) (doctor-define doctor-sent doctor-found))
+ (if (> (length doctor-sent) 12)
+ (setq doctor-sent (doctor-shorten doctor-sent)))
+ (setq doctor-sent (doctor-correct-spelling
+ (doctor-replace doctor-sent doctor--replist)))
+ (cond ((and (not (memq 'me doctor-sent)) (not (memq 'i doctor-sent))
+ (memq 'am doctor-sent))
+ (setq doctor-sent (doctor-replace doctor-sent '((am . (are)))))))
+ (cond ((equal (car doctor-sent) 'yow) (doctor-zippy))
+ ((< (length doctor-sent) 2)
+ (cond ((eq (doctor-meaning (car doctor-sent)) 'howdy)
+ (doctor-howdy))
+ (t (doctor-short))))
+ (t
+ (if (memq 'am doctor-sent)
+ (setq doctor-sent (doctor-replace doctor-sent '((me . (i))))))
+ (setq doctor-sent (doctor-fixup doctor-sent))
+ (if (and (eq (car doctor-sent) 'do) (eq (cadr doctor-sent) 'not))
+ (cond ((zerop (random 3))
+ (doctor-type '(are you (doc$ doctor--afraidof) that \?)))
+ ((zerop (random 2))
+ (doctor-type '(don\'t tell me what to do \. i am the
+ doctor here!))
+ (doctor-rthing))
+ (t
+ (doctor-type '((doc$ doctor--whysay) that i shouldn\'t
+ (cddr doctor-sent)
+ \?))))
+ (doctor-go (doctor-wherego doctor-sent)))))))))
+
+(erb-deftask bytecomp-tasks-compile-doc ()
+ "Byte compile a function."
+ (:version "1.0" :discard-first-sample t)
+ (let ((byte-compile-warnings nil))
+ (erb-task-time (byte-compile bytecomp-tasks-doctor-doc))))
+
+(provide 'bytecomp-tasks)
+;;; bytecomp-tasks.el ends here
diff --git a/benchmark/lisp/kmacro-tasks.el b/benchmark/lisp/kmacro-tasks.el
new file mode 100644
index 00000000000..0226d61eac9
--- /dev/null
+++ b/benchmark/lisp/kmacro-tasks.el
@@ -0,0 +1,44 @@
+ ;;; kmacro-tasks.el --- Enhanced Keyboard Macros -*- lexical-binding: t; -*-
+
+;; Copyright (C) 2018 Free Software Foundation, Inc.
+
+;; Author: Gemini Lasswell <gazally@runbox.com>
+
+;; This program 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.
+
+;; This program 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 this program. If not, see <https://www.gnu.org/licenses/>.
+
+;;; Code:
+
+(require 'erb-task)
+(require 'kmacro)
+
+(erb-deftask kmacro-tasks-edit-lines ()
+ "Edit lines of text using a keyboard macro."
+ (:version "1.0" :discard-first-sample t)
+ (with-temp-buffer
+ (let ((last-kbd-macro (vconcat (kbd "C-s . ")
+ [return]
+ (kbd "C-f C-SPC C-a C-w C-e M-b")
+ [backspace backspace]
+ (kbd "C-SPC C-e C-w C-a C-y SPC C-n C-a"))))
+ (dotimes (i 10) (insert (format "%s. Flintstone, Fred\n" i)))
+ (pop-to-buffer (current-buffer))
+
+ (erb-task-time
+ (goto-char (point-min))
+ (ignore-errors (kmacro-call-macro 0 nil))
+ (goto-char (point-max))
+ (forward-line -1)))))
+
+(provide 'kmacro-tasks)
+;;; kmacro-tasks.el ends here
diff --git a/benchmark/lisp/textmodes/fill-tasks.el b/benchmark/lisp/textmodes/fill-tasks.el
new file mode 100644
index 00000000000..305ad74eae6
--- /dev/null
+++ b/benchmark/lisp/textmodes/fill-tasks.el
@@ -0,0 +1,38 @@
+;;; fill-tasks.el --- Fill Commands -*- lexical-binding: t; -*-
+
+;; Copyright (C) 2018 Free Software Foundation, Inc.
+
+;; Author: Gemini Lasswell <gazally@runbox.com>
+
+;; This program 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.
+
+;; This program 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 this program. If not, see <https://www.gnu.org/licenses/>.
+
+;;; Code:
+
+(require 'erb-task)
+
+(erb-deftask fill-tasks-fill-paragraph ()
+ "Create a long single line paragraph and use fill-paragraph."
+ (:version "1.0")
+ (with-temp-buffer
+ (dotimes (_i 100)
+ (insert "Lorem ipsum dolor sit amet, consectetur adipiscing elit. "))
+ (insert "\n")
+ (pop-to-buffer (current-buffer))
+
+ (erb-task-time
+ (goto-char (point-min))
+ (fill-paragraph))))
+
+(provide 'fill-tasks)
+;;; fill-tasks.el ends here
diff --git a/benchmark/src/cmds-tasks.el b/benchmark/src/cmds-tasks.el
new file mode 100644
index 00000000000..a42a1915b2c
--- /dev/null
+++ b/benchmark/src/cmds-tasks.el
@@ -0,0 +1,40 @@
+;;; cmds-tasks.el --- Simple Editing Commands -*- lexical-binding: t; -*-
+
+;; Copyright (C) 2018 Free Software Foundation, Inc.
+
+;; Author: Gemini Lasswell <gazally@runbox.com>
+
+;; This program 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.
+
+;; This program 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 this program. If not, see <https://www.gnu.org/licenses/>.
+
+;;; Code:
+
+(require 'erb-task)
+
+(defun cmds-tasks-setup-buffer (count)
+ (dotimes (i count)
+ (insert (format "%s. Lorem ipsum dolor sit amet, consectetur adipiscing elit.\n" i)))
+ (pop-to-buffer (current-buffer)))
+
+(erb-deftask cmds-tasks-forward-line ()
+ "Use forward-line to navigate through a buffer."
+ (:version "1.0")
+ (with-temp-buffer
+ (cmds-tasks-setup-buffer 10000)
+ (erb-task-time
+ (goto-char (point-min))
+ (while (< (point) (point-max))
+ (forward-line)))))
+
+(provide 'cmds-tasks)
+;;; cmds-tasks.el ends here
diff --git a/benchmark/src/data-tasks.el b/benchmark/src/data-tasks.el
new file mode 100644
index 00000000000..99f3efdde58
--- /dev/null
+++ b/benchmark/src/data-tasks.el
@@ -0,0 +1,40 @@
+;;; data-tasks.el --- Primitive Operations on Lisp Data Types -*- lexical-binding: t; -*-
+
+;; Copyright (C) 2018 Free Software Foundation, Inc.
+
+;; Author: Gemini Lasswell <gazally@runbox.com>
+
+;; This program 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.
+
+;; This program 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 this program. If not, see <https://www.gnu.org/licenses/>.
+
+;;; Code:
+
+(require 'erb-task)
+
+(erb-deftask data-tasks-prime-p ()
+ "Verify that a large prime number is prime."
+ (:version "1.0")
+ (erb-task-time (data-tasks-prime-p 2305843009)))
+
+(defun data-tasks-prime-p (n)
+ (or (= n 2)
+ (and (> n 2)
+ (= 1 (% n 2))
+ (catch 'not-prime
+ (dotimes (i (1+ (truncate (sqrt n))))
+ (when (and (> i 2) (zerop (% n i)))
+ (throw 'not-prime nil)))
+ t))))
+
+(provide 'data-tasks)
+;;; data-tasks.el ends here
diff --git a/benchmark/src/emacs-tasks.el b/benchmark/src/emacs-tasks.el
new file mode 100644
index 00000000000..075c385bf1c
--- /dev/null
+++ b/benchmark/src/emacs-tasks.el
@@ -0,0 +1,29 @@
+;;; emacs-tasks.el --- Emacs Startup and Shutdown -*- lexical-binding: t; -*-
+
+;; Copyright (C) 2018 Free Software Foundation, Inc.
+
+;; Author: Gemini Lasswell <gazally@runbox.com>
+
+;; This program 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.
+
+;; This program 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 this program. If not, see <https://www.gnu.org/licenses/>.
+
+;;; Code:
+
+(require 'erb-task)
+
+(erb-deftask emacs-tasks-startup ()
+ "Start up and shut down Emacs."
+ (:version "1.0" :special startup))
+
+(provide 'emacs-tasks)
+;;; emacs-tasks.el ends here
diff --git a/benchmark/src/syntax-tasks.el b/benchmark/src/syntax-tasks.el
new file mode 100644
index 00000000000..8554811a700
--- /dev/null
+++ b/benchmark/src/syntax-tasks.el
@@ -0,0 +1,50 @@
+;;; syntax-tasks.el --- Syntax Tables -*- lexical-binding: t; -*-
+
+;; Copyright (C) 2018 Free Software Foundation, Inc.
+
+;; Author: Gemini Lasswell <gazally@runbox.com>
+
+;; This program 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.
+
+;; This program 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 this program. If not, see <https://www.gnu.org/licenses/>.
+
+;;; Code:
+
+(require 'erb-task)
+
+(defun syntax-tasks-setup-buffer (count)
+ (dotimes (i count)
+ (insert (format "%s. Lorem ipsum dolor sit amet, consectetur adipiscing elit.\n" i)))
+ (pop-to-buffer (current-buffer)))
+
+(erb-deftask syntax-tasks-forward-word ()
+ "Use `forward-word' to navigate through a buffer."
+ (:version "1.0")
+ (with-temp-buffer
+ (syntax-tasks-setup-buffer 1000)
+ (erb-task-time
+ (goto-char (point-min))
+ (while (< (point) (point-max))
+ (forward-word)))))
+
+(erb-deftask syntax-tasks-backward-word ()
+ "Use `forward-word' to navigate backwards through a buffer."
+ (:version "1.0")
+ (with-temp-buffer
+ (syntax-tasks-setup-buffer 1000)
+ (erb-task-time
+ (goto-char (point-max))
+ (while (> (point) (point-min))
+ (forward-word -1)))))
+
+(provide 'syntax-tasks)
+;;; syntax-tasks.el ends here