Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • cmucl/cmucl
  • pfominykh/cmucl
  • yitzchak/cmucl
  • rkreuter/cmucl
  • cshapiro/cmucl
5 results
Show changes
Commits on Source (3116)
Showing
with 2285 additions and 274 deletions
((nil
(indent-tabs-mode . t)
(require-final-newline . t)
(tab-width . 8))
(c-mode
(c-basic-offset . 4)))
# http://editorconfig.org
root = true
[*]
indent_style = tab
insert_final_newline = true
tab_width = 8
[*.{c,h}]
indent_size = 4
# Ignore default build directories
# Ignore emacs files
# Ignore fasls
# Ignore files generated by TeX
*.fasl
*.ppcf
*.sparcf
*.sse2f
*.x86f
*~
/test-tmp
build-*
darwin-8bit-[234]
darwin-[234]
linux-8bit-[234]
linux-[234]
sparc-8bit-[234]
sparc-[234]
src/docs/cmu-user/*.aux
src/docs/cmu-user/*.cdx
src/docs/cmu-user/*.cnd
src/docs/cmu-user/*.fdx
src/docs/cmu-user/*.fnd
src/docs/cmu-user/*.idx
src/docs/cmu-user/*.ilg
src/docs/cmu-user/*.log
src/docs/cmu-user/*.out
src/docs/cmu-user/*.pdf
src/docs/cmu-user/*.tdx
src/docs/cmu-user/*.tnd
src/docs/cmu-user/*.toc
src/docs/cmu-user/*.vdx
src/docs/cmu-user/*.vnd
variables:
download_url: "https://common-lisp.net/project/cmucl/downloads/snapshots/2024/08"
version: "2024-08-x86"
bootstrap: "-B boot-2024-08"
# Default install configuration to download the cmucl tarballs to use
# for building.
.install_template: &install_configuration
stage: install
artifacts:
paths:
- snapshot/
script:
- echo PATH = $PATH
- ls -F /usr/local/bin
- type -all gitlab-runner
# Download binaries. (Do we really need the extras tarball?)
- $CURL -o cmucl-$version-$osname.tar.bz2 $download_url/cmucl-$version-$osname.tar.bz2
- $CURL -o cmucl-$version-$osname.extra.tar.bz2 $download_url/cmucl-$version-$osname.extra.tar.bz2
- mkdir snapshot
- (cd snapshot; tar xjf ../cmucl-$version-$osname.tar.bz2; tar xjf ../cmucl-$version-$osname.extra.tar.bz2)
# Default build configuration to be added to each build stage for each
# OS. This assumes we don't need anything special between OSes, and
# the option '-C ""' is good enough. We also override the default
# build dirs by using the -b option so that we know where the results
# are, independent of OS.
.build_template: &build_configuration
stage: build
artifacts:
paths:
- dist/
- build-2/*.log
- build-3/*.log
- build-4/
# Needed by Linux analyzer stage
- src/lisp/cmucl-version.h
script:
# Do cross compile first
#- bin/create-target.sh xtarget x86_linux_clang
#- bin/create-target.sh xcross x86_linux_clang
#- bin/cross-build-world.sh -crl -B boot-2020-04-1 xtarget xcross src/tools/cross-scripts/cross-x86-x86.lisp snapshot/bin/lisp
# Regular build using the cross-compiled result or snapshot. The
# analyzer job requires gcc, so make sure we build with gcc here
# instead of clang.
- bin/build.sh $bootstrap -b build -R -C "" -o snapshot/bin/lisp
# When the result of `git describe` cannot be used as a version
# string, an alternative can be provided with the -V flag
- bin/make-dist.sh -I dist build-4
# Default configuration for running the ansi-tests.
.ansi_test_template: &ansi_test_configuration
stage: ansi-test
artifacts:
paths:
- ansi-test/test.out
script:
- bin/run-ansi-tests.sh -l dist/bin/lisp
# Default configuration for running unit tests.
.unit_test_template: &unit_test_configuration
stage: test
artifacts:
paths:
- ansi-test/test.out
- test.log
script:
- echo LANG = $LANG
- bin/run-unit-tests.sh -l dist/bin/lisp 2>&1 | tee test.log
# Default configuration to test creation of lisp executable and
# testing the exectuable works.
.exec_test_template: &exec_test_configuration
stage: test
script:
# Create an executable and test it by printing the version.
- dist/bin/lisp -eval '(save-lisp "saved-lisp-executable" :executable t)'
- ./saved-lisp-executable --version
# Default configuration for running the benchmarks.
.benchmark_template: &benchmark_configuration
stage: benchmark
artifacts:
paths:
- benchmarks/cl-bench/results
script:
- cd benchmarks/cl-bench
- mkdir tmp
- CMUCL=../../snapshot/bin/lisp ./run-cmucl.sh
- CMUCL=../../dist/bin/lisp ./run-cmucl.sh
- ../../snapshot/bin/lisp -load report
stages:
- install
- build
- test
- ansi-test
- benchmark
- analyze
cache:
#### Linux jobs ####
linux:install:
<<: *install_configuration
tags:
- linux
variables:
osname: "linux"
CURL: "curl"
linux:build:
<<: *build_configuration
tags:
- linux
needs:
- job: linux:install
artifacts: true
linux:cross-build:
stage: build
tags:
- linux
artifacts:
paths:
- xdist/
- linux-2/*.log
- linux-3/*.log
- linux-4/*.log
# The lisp directory is needed for the static analyzer job.
- linux-4/lisp
needs:
# Normally need the linux:install stage to get the compiler to
# use. But for #337, we need the normal build from linux:build to
# do the cross-compile. Once the snapshot is made, we can use
# linux:install instead.
- job: linux:build
#- job: linux:install
artifacts: true
script:
- bin/create-target.sh xtarget
- bin/create-target.sh xcross
- bin/cross-build-world.sh -crl xtarget xcross src/tools/cross-scripts/cross-x86-x86.lisp dist/bin/lisp
- bin/build.sh -b xlinux $bootstrap -R -C "" -o "xtarget/lisp/lisp -lib xtarget/lisp"
- bin/make-dist.sh -I xdist xlinux-4
linux:test:
<<: *unit_test_configuration
tags:
- linux
needs:
# Needs artifacts from build (dist/)
- job: linux:build
artifacts: true
linux:exec-test:
<<: *exec_test_configuration
tags:
- linux
needs:
- job: linux:build
artifacts: true
linux:cross-test:
stage: test
tags:
- linux
artifacts:
paths:
- ansi-test/test.out
- cross-test.log
needs:
# Needs artifacts from build (dist/)
- job: linux:cross-build
artifacts: true
script:
- bin/run-unit-tests.sh -l xdist/bin/lisp 2>&1 | tee cross-test.log
linux:ansi-test:
<<: *ansi_test_configuration
tags:
- linux
needs:
# Needs artifacts from build (dist/)
- job: linux:build
artifacts: true
linux:benchmark:
<<: *benchmark_configuration
tags:
- linux
needs:
# Needs artifacts from install (snapshot/) and build (dist/)
- job: linux:install
artifacts: true
- job: linux:build
#### OSX (Mac) jobs ####
osx:install:
<<: *install_configuration
tags:
- macos-virtualbox
variables:
osname: "darwin"
CURL: "/opt/local/bin/curl"
osx:build:
<<: *build_configuration
tags:
- macos-virtualbox
needs:
- job: osx:install
artifacts: true
osx:test:
<<: *unit_test_configuration
tags:
- macos-virtualbox
needs:
# Needs artifacts from build (dist/)
- job: osx:build
artifacts: true
osx:exec-test:
<<: *exec_test_configuration
tags:
- macos-virtualbox
needs:
- job: osx:build
artifacts: true
osx:ansi-test:
<<: *ansi_test_configuration
tags:
- macos-virtualbox
needs:
# Needs artifacts from build (dist/)
- job: osx:build
artifacts: true
osx:benchmark:
<<: *benchmark_configuration
tags:
- macos-virtualbox
needs:
# Needs artifacts from install (snapshot/) and build (dist/)
- job: osx:install
artifacts: true
- job: osx:build
# Optional job that runs the static analyzer. It needs the files from
# the linux-4 directory built in the linux:build job.
linux:static-analyzer:
stage: analyze
when: manual
tags:
- linux
artifacts:
paths:
- analyzer.log
needs:
- job: linux:build
artifacts: true
script:
# Analysis can generate huge amounts of output. For now just save
# the results to the log file instead of also having it go to the
# console. If someday there's less or no output, we can consider
# having the logs go to the console too.
- make -C build-4/lisp clean
- make -C build-4/lisp CFLAGS=-fanalyzer > analyzer.log 2>&1
#### OpenSUSE jobs ####
opensuse:install:
<<: *install_configuration
tags:
- opensuse
variables:
osname: "linux"
CURL: "curl"
opensuse:build:
<<: *build_configuration
tags:
- opensuse
needs:
- job: opensuse:install
artifacts: true
opensuse:test:
<<: *unit_test_configuration
tags:
- opensuse
needs:
# Needs artifacts from build (dist/)
- job: opensuse:build
artifacts: true
opensuse:ansi-test:
<<: *ansi_test_configuration
tags:
- opensuse
needs:
# Needs artifacts from build (dist/)
- job: opensuse:build
artifacts: true
## Describe the bug
A clear and concise description of what the bug is.
## To Reproduce
Steps to reproduce the behavior:
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error
## Expected behavior
A clear and concise description of what you expected to happen.
## Screenshots
If applicable, add screenshots to help explain your problem.
## Desktop (please complete the following information):
- OS: [e.g. Linux]
- Version: [e.g. 21e]
## Additional context
Add any other context about the problem here.
/label ~bug
## Describe the feature
Briefly describe the feature you would like see.
## Is there a prototype?
If you have a prototype, provide links to illustrate this addition. This is the best way to propose a new feature.
## Describe the feature in more detail
Provide more information to describe the feature.
/label ~feature
This diff is collapsed.
[![pipeline status](https://gitlab.common-lisp.net/cmucl/cmucl/badges/master/pipeline.svg)](https://gitlab.common-lisp.net/cmucl/cmucl/commits/master)
CMUCL is a free, high performance implementation of the Common Lisp
programming language which runs on most major Unix platforms. It
mainly conforms to the ANSI Common Lisp standard. CMUCL provides a
sophisticated native code compiler; a powerful foreign function
interface; an implementation of CLOS; the Common Lisp Object System;
which includes multimethods; a metaobject protocol; a source-level
debugger and code profiler; and an Emacs-like editor implemented in
Common Lisp. CMUCL is maintained by a team of volunteers collaborating
over the Internet, and is mostly in the public domain.
Here is a summary of its main features:
* support for **static arrays** that are never moved by GC but are
properly removed when no longer referenced.
* **Unicode** support, including many of the most common external
formats such as UTF-8 and support for handling Unix, DOS, and
Mac end-of-line schemes.
* native **double-double floats** including complex double-double
floats and specialized arrays for double-double floats and and
complex double-double floats that give approximately 106 bits
(32 digits) of precision.
* a **sophisticated native-code compiler** which is capable of
powerful type inferences, and generates code competitive in
speed with C compilers.
* **generational garbage collection** on all supported
architectures.
* **multiprocessing capability** on the x86 ports.
* a foreign function interface which allows interfacing with C code
and system libraries, including shared libraries on most platforms,
and direct access to Unix system calls.
* support for interprocess communication and remote procedure calls.
* an implementation of CLOS, the [Common Lisp Object
System](http://en.wikipedia.org/wiki/Common_Lisp_Object_System),
which includes multimethods and a metaobject protocol.
* a graphical source-level debugger using a Motif interface, and a
code profiler.
* an interface to the X11 Window System (CLX), and a sophisticated
graphical widget library ([Garnet](https://www.cs.cmu.edu/~garnet/),
available separately).
* programmer-extensible input and output streams ([Gray
Streams](http://www.nhplace.com/kent/CL/Issues/stream-definition-by-user.html)
and
[simple-streams](http://www.franz.com/support/documentation/current/doc/streams.htm)).
* an Emacs-like editor,
[Hemlock](http://cmucl.org/hemlock/index.html), implemented in
Common Lisp.
* **freely redistributable**: free, with full source code (most of
which is in the public domain) and no strings attached (and no
warranty). Like the GNU/Linux and *BSD operating systems, CMUCL is
maintained and improved by a team of volunteers collaborating over
the Internet.
For the latest news and other information, see [the wiki](https://gitlab.common-lisp.net/cmucl/cmucl/wikis/home).
\ No newline at end of file
;;; -*- Mode: LISP; Syntax: Common-Lisp; Base: 10; Package: x86 -*-
;;;
;;; **********************************************************************
;;; This code was written as part of the CMU Common Lisp project at
;;; Carnegie Mellon University, and has been placed in the public domain.
;;; If you want to use this code or any part of CMU Common Lisp, please contact
;;; Scott Fahlman or slisp-group@cs.cmu.edu.
;;;
(ext:file-comment
"$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/assembly/x86/alloc.lisp,v 1.5 1998/02/19 19:37:25 dtc Rel $")
;;;
;;; **********************************************************************
;;;
;;; Stuff to handle allocating simple objects.
;;;
;;; Written by William Lott.
;;;
;;; Debugged by Paul F. Werkowski -- Spring 1995.
;;;
(in-package :x86)
;;;; From from signed/unsigned
#+assembler ; we don't want a vop for this one.
(define-assembly-routine
(move-from-signed)
((:temp eax unsigned-reg eax-offset)
(:temp ebx unsigned-reg ebx-offset))
(inst mov ebx eax)
(inst shl ebx 1)
(inst jmp :o bignum)
(inst shl ebx 1)
(inst jmp :o bignum)
(inst ret)
BIGNUM
(with-fixed-allocation (ebx bignum-type (+ bignum-digits-offset 1))
(storew eax ebx bignum-digits-offset other-pointer-type))
(inst ret))
#+assembler ; we don't want a vop for this one either.
(define-assembly-routine
(move-from-unsigned)
((:temp eax unsigned-reg eax-offset)
(:temp ebx unsigned-reg ebx-offset))
(inst test eax #xe0000000)
(inst jmp :nz bignum)
;; Fixnum
(inst mov ebx eax)
(inst shl ebx 2)
(inst ret)
BIGNUM
;;; Note: On the mips port space for a two word bignum is always
;;; allocated and the header size is set to either one or two words
;;; as appropriate. On the mips port this is faster, and smaller
;;; inline, but produces more garbage. The inline x86 version uses
;;; the same approach, but here we save garbage and allocate the
;;; smallest possible bignum.
(inst jmp :ns one-word-bignum)
(inst mov ebx eax)
;; Two word bignum
(with-fixed-allocation (ebx bignum-type (+ bignum-digits-offset 2))
(storew eax ebx bignum-digits-offset other-pointer-type))
(inst ret)
ONE-WORD-BIGNUM
(with-fixed-allocation (ebx bignum-type (+ bignum-digits-offset 1))
(storew eax ebx bignum-digits-offset other-pointer-type))
(inst ret))
# To modify optimization settings, you can change the $(OPTIMIZE)
# variable below. This is prepended to the lisp source files before
# they are compiled.
#
# Requires GNU Make or equivalent.
SHELL = /bin/sh
OPTIMIZE = "(declaim (optimize (speed 3) (space 1) (safety 0) (debug 0) (compilation-speed 0)))"
FILES := $(patsubst %.lisp,%.olisp, $(wildcard files/*.lisp))
vpath %.lisp files
%.olisp: %.lisp
echo $(OPTIMIZE) > $@
cat $< >> $@
optimize-files: $(FILES)
clean-results:
-rm -f /var/tmp/CL-bench*
clean:
find . \( -name '*.abcl' -o -name '*.cls' -o -name '*.sparcf' -o -name "*.ppcf" -o -name '*.x86f' -o -name '*.lbytef' -o -name "*.err" -o -name '*.fas' -o -name '*.fasl' -o -name "*.faslmt" -o -name '*.lib' -o -name '*.o' -o -name '*.so' -o -name "*.pfsl" -o -name "*.ufsl" -o -name "*.dfsl" -o -name "*.olisp" -o -name "*.dfsl" -o -name "*.fsl" -o -name "*.nfasl" \) -print | xargs rm -f
distclean: clean clean-results
.PHONY: clean clean-results distclean optimize-files
# EOF
=== New in 2004-08-01 ===
Fixes to WALK-LIST/SEQ and WALK-LIST/MESS that were previously
non-deterministic, due to the use of RANDOM in creating the data
structures that they work on.
=== New in 2004-01-03 ===
New tests: SUM-PERMUTATIONS, WALK-LIST/SEQ, WALK-LIST/MESS, COMPILER,
LOAD-FASL. SUM-PERMUTATIONS is inspired by Scheme benchmarks by
Will Clinger. The WALK-LIST/ tests are inspired by Richard Fateman.
A setup file for MCL, contributed by James Anderson.
New ascii-graphical report generator contributed by Johannes
Grödem (file graph-report.lisp).
New PDF report generator using the cl-pdf library (file
pdf-report.lisp)
Improvements to the CMUCL performance-counter code: better
reporting of data. Look for a new version of cpc.lisp that supports
UltraSPARC-III processors.
=== New in 2003-12-05 ===
Split the FPRINT test (speed of printer when writing to a file)
into FPRINT/PRETTY and FPRINT/UGLY. The former does pretty-printing
using PPRINT (and binds other pretty-printer-related variables to
T), whereas the latter disables the pretty-printer. Suggested by
Christopher Rhodes.
=== New in 2003-10-06 ===
Support for Allegro CL, thanks to Kevin Layer. See the file
run-acl.sh and sysdep/setup-acl.lisp.
Fiddle with CPU Performance Counters library on UltraSPARC processors
with CMUCL; see play/cmucl-performance-counters.lisp
Common Lisp benchmarking suite
==============================
This package contains Lisp code intended for performance benchmarking
of different Common Lisp implementations. The tests it runs include
- the well-known Gabriel benchmarks, with a number of bugfixes from
Henry Baker and limited rewriting to bring them a little closer to
modern Common Lisp coding style
- hashtable exercising
- READ-LINE exercising
- mathematical functions: factorial, fibonnaci, ackermann's number
- some bignum-intensive code from Bruno Haible
- various aspects of CLOS: time taken to compile and execute
DEFCLASS forms which create a class hierarchy, instance creation
time, time taken to compile and execute DEFMETHOD forms, execution
of method combinations, both with and without :after methods.
- various operations on arrays, bitvectors and strings
- performance-intensive kernels such as CRC generation and an
implementation of the DEFLATE algorithm
Except for the CLOS COMPILER tests, timings do not include compilation
time. The garbage collector is run before each test to try to make the
timings more repeatable. For certain targets, we assume that the times
reported by GET-INTERNAL-RUN-TIME and GET-INTERNAL-REAL-TIME are
accurate. Timings for a given Common Lisp environment may be quite
sensitive to the optimization settings; these are set at the beginning
of the Makefile.
Common Lisp is a very large language, so it is difficult to evaluate
the performance of all aspects of an implementation. Remember that the
only real benchmark is your application: this code is only
representative of real-life programs to a limited extent.
Running the suite
=================
Each implementation has a run-<impl>.sh file, and a setup-<impl>.lisp
file in the sysdep directory. To execute the test for CMUCL, for
exampe, type
bash run-cmucl.sh
This will create files with the optimization setting requested in the
Makefile, then invoke CMUCL to compile the files (lots of warnings and
compilation notes are to be expected), then run the various tests.
Execution takes quite a while: around 30 minutes on a 1GHz PIII. A
large part of this time is due to the bignum benchmarks, which you can
comment out if they don't interest you. You can also reduce the number
of executions of each particular test by editing the file "tests.lisp"
-- modify the :runs parameter of the DEFBENCH forms in the file
"tests.lisp". For the results to be meaningful, the time for each test
should be more than a second. However, when comparing implementations
it is not the absolute time which counts, but the time relative to the
other implementations. Also note that you may wish to reduce the size
of the problems, particularly in the array sections, because with some
setups (CMUCL on Linux for example), your system may become unusable
if you exceed available RAM. You can do this by editing the file
"tests.lisp" and modifying the arguments to the :code parameters.
Repeat this operation for other implementations you have on your
machine. I have tried it with CMUCL, SBCL, CLISP, OpenMCL, Poplog
CL and LispWorks on various platforms. GCL and ECL are able to run
some of the tests.
If you're not running on a Unix platform, you may not be able to
script the different steps of a run. In this case, follow the
following steps:
1. Say "make clean optimize-lisp" to create source files that contain
optimization declarations. The optimize settings can be changed
in the Makefile.
2. Load the file "generate.lisp" into your implementation. This
should create two files "do-compilation-script.lisp" and
"do-execute-script.lisp", that contain a sequence of compilation
and load steps.
3. Load the file "sysdep/setup-<yourimpl>.lisp", which you may need
to write yourself. This requires a definition of a BENCH-GC
function that triggers a full garbage collection.
4. Load the file "do-compilation-script.lisp" into your
implementation, which should result in all the source files
being compiled.
5. Load the file "do-execute-script.lisp", which should cause all
the tests to be executed.
For each tested implementation, you should have a file in /var/tmp (or
in the current directory on Windows) named "CL-benchmark-<date>".
These files will have the following format:
,---- /var/tmp/CL-benchmark-20010821T2208 ---
| ;; -*- lisp -*- CMU Common Lisp CVS sources, level-1 built 2001-08-22 on maftia1
| ;;
| ;; Implementation *features*:
| ;; (:PCL-STRUCTURES :PORTABLE-COMMONLOOPS :PYTHON :PCL :COMPLEX-FP-VOPS :PPRO
| ;; :PENTIUM :MP :HASH-NEW :RANDOM-MT19937 :PROPAGATE-FUN-TYPE
| ;; :PROPAGATE-FLOAT-TYPE :CONSTRAIN-FLOAT-TYPE :CMU18C :CMU18 :GENCGC :X86
| ;; :LINUX :GLIBC2 :UNIX :COMMON :COMMON-LISP :ANSI-CL :CMU
| ;; :IEEE-FLOATING-POINT)
| ;;
| ;; Function real user sys consed
| ;; ----------------------------------------------------------------
| ;; Boyer 1.50 1.22 0.28 54349520
| ;; Browse 0.97 0.79 0.18 36219256
| ;; DDerviv 0.88 0.50 0.39 67197656
| ;; Deriv 1.64 0.87 0.77 127195824
| ;; Destructive 0.30 0.24 0.05 12819928
| ;; div2-test-1 0.52 0.32 0.20 38398176
| ;; div2-test2 0.66 0.42 0.24 47999936
| ;; FFT 0.40 0.40 0.00 0
| ;; frpoly/fixnum 0.65 0.54 0.10 19172440
| ;; frpoly/bignum 1.54 1.25 0.28 55628704
| ;; frpoly/float 7.59 6.50 1.09 213052408
| ;; Puzzle 0.82 0.82 0.00 0
| ;; CTak 0.81 0.81 0.00 0
| ;; Tak 0.53 0.54 0.00 0
| ;; RTak 0.35 0.36 0.00 0
| ;; takl 1.60 1.60 0.00 0
| ;; stak 1.15 1.14 0.00 0
| ;; fprint 0.25 0.25 0.01 1948416
| ;; fread 0.82 0.68 0.13 28487280
| ;; traverse 5.28 5.24 0.03 4493288
| ;; triangle 2.29 2.28 0.00 499712
| ;; factorial 0.37 0.18 0.20 26120296
| ;; fib 2.39 2.39 0.00 0
| ;; hashtable 0.72 0.69 0.04 9888912
| ;; CLOS/defclass 2.82 2.31 0.12 32757328
| ;; CLOS/defmethod 10.94 10.09 0.55 120612624
| ;; CLOS/instantiate 7.13 6.27 0.86 229048352
| ;; CLOS/methodcalls 6.56 5.22 1.34 301057608
| ;; CLOS/method+after 12.02 11.09 0.93 197058816
| ;; CLOS/complex-methods 0.38 0.38 0.00 286600
| ;; 1D-arrays 2.46 2.17 0.30 60002400
| ;; 2D-arrays 20.57 19.50 1.07 240000240
| ;; bitvectors 18.75 18.51 0.23 50003200
| ;; fill-strings 21.12 15.23 5.88 1000016000
| ;; fill-strings/adjustable 57.10 56.25 0.85 259729520
|
| ("CMU Common Lisp CVS sources, level-1 built 2001-08-22 on maftia1"
| ("fill-strings/adjustable" 57.1 56.25 0.85 259729520)
| ("fill-strings" 21.12 15.23 5.88 1000016000)
| ("bitvectors" 18.75 18.51 0.23 50003200)
| ("2D-arrays" 20.57 19.5 1.07 240000240) ("1D-arrays" 2.46 2.17 0.3 60002400)
| ("CLOS/complex-methods" 0.38 0.38 0.0 286600)
| ("CLOS/method+after" 12.02 11.09 0.93 197058816)
| ("CLOS/methodcalls" 6.56 5.22 1.34 301057608)
| ("CLOS/instantiate" 7.13 6.27 0.86 229048352)
| ("CLOS/defmethod" 10.94 10.09 0.55 120612624)
| ("CLOS/defclass" 2.82 2.31 0.12 32757328) ("hashtable" 0.72 0.69 0.04 9888912)
| ("fib" 2.39 2.39 0.0 0) ("factorial" 0.37 0.18 0.2 26120296)
| ("triangle" 2.29 2.28 0.0 499712) ("traverse" 5.28 5.24 0.03 4493288)
| ("fread" 0.82 0.68 0.13 28487280) ("fprint" 0.25 0.25 0.01 1948416)
| ("stak" 1.15 1.14 0.0 0) ("takl" 1.6 1.6 0.0 0) ("RTak" 0.35 0.36 0.0 0)
| ("Tak" 0.53 0.54 0.0 0) ("CTak" 0.81 0.81 0.0 0) ("Puzzle" 0.82 0.82 0.0 0)
| ("frpoly/float" 7.59 6.5 1.09 213052408)
| ("frpoly/bignum" 1.54 1.25 0.28 55628704)
| ("frpoly/fixnum" 0.65 0.54 0.1 19172440) ("FFT" 0.4 0.4 0.0 0)
| ("div2-test2" 0.66 0.42 0.24 47999936) ("div2-test-1" 0.52 0.32 0.2 38398176)
| ("Destructive" 0.3 0.24 0.05 12819928) ("Deriv" 1.64 0.87 0.77 127195824)
| ("DDerviv" 0.88 0.5 0.39 67197656) ("Browse" 0.97 0.79 0.18 36219256)
| ("Boyer" 1.5 1.22 0.28 54349520))
`----
The first section of the file is intended to be human readable, and
the second section to be READ by a Common Lisp implementation. For
each test, you should see the elapsed user time, and possibly (if this
has been coded for your implementation) elapsed system time and the
number of bytes consed during the test execution.
The data in the different /var/tmp/CL-benchmark-* files is analysed by the
file "report.lisp", to generate a report comparing the performance of
the different implementations. This file needs to be run in a Common
Lisp implementation; the one you use will be considered the
"reference" implementation. In the report which is generated, for each
test the timing for the reference implementation will be shown, as
well as the _relative times_ for each of the other tested
implementations. A relative time means that a score under 1 is better,
and a score of 2 means it is two times slower -- for that test -- than
the reference implementation. If a given test doesn't work in a
particular implementation (for example CLISP doesn't do non-standard
method combination), its entry will be -1.0.
Here is an example of the type of results you can obtain, for x86 and
SPARC:
,---- PentiumIII at 1GHz, 256MB RAM, Linux 2.4.2 ---
|
| Benchmark Reference CLISP CMU C SBCL
| ----------------------------------------------------------------
| BOYER 2.36 4.54 0.67 0.94
| BROWSE 1.04 2.15 0.65 1.04
| DDerviv 1.19 1.96 0.48 1.06
| Deriv 2.27 1.93 0.42 1.04
| DESTRUCTIVE 1.52 2.79 0.89 1.06
| DIV2-TEST-1 1.73 1.84 0.51 1.09
| DIV2-TEST-2 0.85 1.87 0.46 1.12
| FFT 0.22 36.09 1.14 1.14
| FRPOLY/FIXNUM 0.79 5.81 0.81 0.96
| FRPOLY/BIGNUM 1.99 2.03 0.68 0.96
| FRPOLY/FLOAT 0.78 3.79 0.72 0.99
| PUZZLE 0.79 23.09 1.15 9.95
| CTAK 0.86 6.28 1.10 1.06
| TAK 0.91 8.86 1.18 1.34
| RTAK 0.91 8.86 1.13 1.34
| TAKL 1.67 7.33 1.16 1.22
| STAK 1.15 6.66 1.15 1.10
| FPRINT 1.42 1.12 1.05 2.37
| TRAVERSE 4.35 6.75 1.19 1.64
| TRIANGLE 2.01 17.22 1.14 1.27
| CASCOR 4.06 80.47 1.23 0.92
| RICHARDS 0.58 24.78 1.22 1.07
| FACTORIAL 0.50 3.56 0.68 1.38
| FIB 0.39 5.67 1.13 1.08
| BIGNUM/ELEM-100-1000 1.33 0.11 1.02 0.98
| BIGNUM/ELEM-1000-100 6.03 0.07 1.11 0.93
| BIGNUM/ELEM-10000-1 6.14 0.05 1.00 0.93
| BIGNUM/PARI-100-10 1.51 0.06 0.96 0.91
| BIGNUM/PARI-200-5 17.32 0.02 0.99 0.88
| HASH-STRINGS 1.65 3.00 0.82 0.99
| HASH-INTEGERS 0.73 2.30 0.68 1.05
| BOEHM-GC 10.18 3.94 0.39 1.19
| CLOS/defclass 2.64 0.35 0.83 2.33
| CLOS/defmethod 13.93 0.02 0.70 1.94
| CLOS/instantiate 7.23 1.02 0.63 1.39
| CLOS/methodcalls 8.43 1.33 0.50 1.37
| CLOS/method+after 13.90 0.45 0.79 2.64
| CLOS/complex-methods 0.35 -1.00 1.06 5.40
| 1D-ARRAYS 3.74 4.57 0.69 1.26
| 2D-ARRAYS 15.19 3.25 0.92 4.00
| BITVECTORS 2.92 0.61 0.70 0.95
| FILL-STRINGS 10.62 1.15 0.76 3.03
| fill-strings/adjustable 18.13 1.08 0.92 1.65
| BENCH-STRING-CONCAT 9.99 -1.00 0.81 2.34
|
| Reference implementation: CMU Common Lisp 18c
| Impl CLISP: CLISP 2.27 (released 2001-07-17) (built 3204291355) (memory 3205854943)
| Impl CMU C: CMU Common Lisp 18d-pre, level-1 built 2001-12-14 on maftia1
| Impl SBCL : SBCL 0.7.0
| Linux maftia1 2.4.2-2 #1 Sun Apr 8 20:41:30 EDT 2001 i686 unknown
`----
,---- UltraSPARCIIe at 500MHz, 640MB RAM, SunOS 5.8 ---
|
| Benchmark Reference CMU C CLISP
| -----------------------------------------------------
| BOYER 3.98 0.91 8.03
| BROWSE 1.72 0.91 2.85
| DDerviv 2.02 0.75 3.21
| Deriv 3.63 0.81 3.13
| DESTRUCTIVE 3.11 1.01 4.18
| DIV2-TEST-1 2.19 0.83 3.92
| DIV2-TEST-2 1.12 0.82 3.85
| FFT 0.74 1.03 28.86
| FRPOLY/FIXNUM 1.87 1.01 7.89
| FRPOLY/BIGNUM 4.59 1.29 3.07
| FRPOLY/FLOAT 1.65 0.96 5.68
| PUZZLE 2.07 0.95 30.62
| CTAK 2.74 1.01 9.04
| TAK 1.84 1.00 14.08
| RTAK 1.84 1.01 13.95
| TAKL 3.37 1.01 11.63
| STAK 2.32 1.01 8.87
| FPRINT 4.17 1.02 1.12
| TRAVERSE 5.84 0.99 13.74
| TRIANGLE 5.53 0.86 15.57
| CASCOR 10.53 0.73 52.81
| RICHARDS 2.35 0.94 22.46
| FACTORIAL 1.46 1.48 2.88
| FIB 0.94 0.99 6.71
| BIGNUM/ELEM-100-1000 2.80 1.24 0.28
| BIGNUM/ELEM-1000-100 10.14 1.19 0.44
| BIGNUM/ELEM-10000-1 11.38 1.35 0.41
| BIGNUM/PARI-100-10 2.76 1.15 0.09
| BIGNUM/PARI-200-5 27.19 1.06 0.05
| READ-LINE 3.39 1.06 1.19
| HASH-STRINGS 5.42 1.20 2.19
| HASH-INTEGERS 1.61 0.76 2.00
| BOEHM-GC 19.97 0.76 4.14
| CLOS/defclass 4.78 1.01 0.81
| CLOS/defmethod 27.61 0.89 0.03
| CLOS/instantiate 20.93 0.85 1.28
| CLOS/methodcalls 23.62 1.08 1.94
| CLOS/method+after 33.70 1.07 0.78
| CLOS/complex-methods 1.41 0.92 -1.00
| 1D-ARRAYS 10.77 0.92 3.51
| 2D-ARRAYS 56.66 1.40 2.61
| BITVECTORS 5.35 0.86 0.42
| FILL-STRINGS 18.88 1.07 0.97
| fill-strings/adjustable 45.09 1.46 1.41
| BENCH-STRING-CONCAT 48.10 0.90 -1.00
|
| Reference implementation: CMU Common Lisp 18c, Built 2000-11-27
| Impl CMU C: CMU Common Lisp 18d-pre, level-1 built 2001-12-12 on liszt
| Impl CLISP: CLISP 2.27.2 (released 2001-10-05) (built on moustacho)
| SunOS eagles 5.8 Generic_108528-10 sun4u sparc SUNW,Sun-Blade-100
`----
Note that the test suite doesn't take compilation time into account
(except for the CLOS-related tests, where the compiler may be used at
runtime to create effective methods). You can use the time taken to
load do-compilation-script.lisp as a rough proxy for compilation time.
"Life is short and it was not meant to be spent making people feel guilty
about instruction pipelines being only partly full or caches being missed."
-- Kent Pitman in <sfw7ksm3b7k.fsf@shell01.TheWorld.com>
Thanks
======
Raymond Toy, Christophe Rhodes, Peter Van Eynde, Sven Van
Caekenberghe, Christophe Rhodes, Kevin Layers and possibly others that
I have forgotten to note.
Related work
============
- @misc{ gabriel86performance,
author = "R. Gabriel",
title = "Performance and Evaluation of Lisp Systems",
text = "R. P. Gabriel. Performance and Evaluation of Lisp Systems. MIT Press, Cambridge,
Massachusetts, 1986.",
year = "1986" }
- Scheme benchmarks by Will Clinger (Larceny and TwoBit compilers)
<URL:http://www.ccs.neu.edu/home/will/GC/sourcecode.html>
- Bagley's Programming Language Shootout,
<URL:http://www.bagley.org/~doug/shootout/>
Eric Marsden <emarsden@laas.fr>
- convert all physical pathnames to constructed pathnames
;;; defpackage.lisp -- DEFPACKAGE forms for the cl-bench modules
;;
;; Time-stamp: <2004-01-01 emarsden>
(defpackage :cl-bench
(:use :common-lisp
#+cmu :ext
#+clisp :ext
#+allegro :excl))
(defpackage :cl-bench.gabriel
(:use :common-lisp)
(:export #:boyer
#:browse
#:dderiv-run
#:deriv-run
#:run-destructive
#:run-div2-test1
#:run-div2-test2
#:div2-l
#:run-fft
#:run-frpoly/fixnum
#:run-frpoly/bignum
#:run-frpoly/float
#:run-puzzle
#:run-tak
#:run-ctak
#:run-trtak
#:run-takl
#:run-stak
#:fprint/pretty
#:fprint/ugly
#:run-traverse
#:run-triangle))
(defpackage :cl-bench.math
(:use :common-lisp)
(:export #:run-factorial
#:run-fib
#:run-fib-ratio
#:run-ackermann
#:run-mandelbrot/complex
#:run-mandelbrot/dfloat
#:run-mrg32k3a))
(defpackage :cl-bench.crc
(:use :common-lisp)
(:export #:run-crc40))
(defpackage :cl-bench.bignum
(:use :common-lisp)
(:export #:run-elem-100-1000
#:run-elem-1000-100
#:run-elem-10000-1
#:run-pari-100-10
#:run-pari-200-5
#:run-pari-1000-1
#:run-pi-decimal/small
#:run-pi-decimal/big
#:run-pi-atan))
(defpackage :cl-bench.ratios
(:use :common-lisp)
(:export #:run-pi-ratios))
(defpackage :cl-bench.hash
(:use :common-lisp)
(:export #:run-slurp-lines
#:hash-strings
#:hash-integers))
(defpackage :cl-bench.boehm-gc
(:use :common-lisp)
(:export #:gc-benchmark))
(defpackage :cl-bench.deflate
(:use :common-lisp)
(:export #:run-deflate-file))
(defpackage :cl-bench.arrays
(:use :common-lisp)
(:export #:bench-1d-arrays
#:bench-2d-arrays
#:bench-3d-arrays
#:bench-bitvectors
#:bench-strings
#:bench-strings/adjustable
#:bench-string-concat
#:bench-search-sequence))
(defpackage :cl-bench.richards
(:use :common-lisp)
(:export #:richards))
(defpackage :cl-bench.clos
(:use :common-lisp)
(:export #:run-defclass
#:run-defmethod
#:make-instances
#:make-instances/simple
#:methodcalls/simple
#:methodcalls/simple+after
#:methodcalls/complex
#:run-eql-fib))
(defpackage :cl-bench.misc
(:use :common-lisp)
(:export #:run-compiler
#:run-fasload
#:run-permutations
#:walk-list/seq
#:walk-list/mess))
(defpackage :cl-ppcre-test
(:use :common-lisp)
(:export #:test))
;; EOF
;;; auto-generated from file #p"generate.lisp"
(IN-PACKAGE :CL-USER)
(LOAD #p"defpackage.lisp")
(COMPILE-FILE #p"files/arrays.olisp")
(COMPILE-FILE #p"files/bignum.olisp")
(COMPILE-FILE #p"files/boehm-gc.olisp")
(COMPILE-FILE #p"files/clos.olisp")
(COMPILE-FILE #p"files/crc40.olisp")
(COMPILE-FILE #p"files/deflate.olisp")
(COMPILE-FILE #p"files/gabriel.olisp")
(COMPILE-FILE #p"files/hash.olisp")
(COMPILE-FILE #p"files/math.olisp")
(COMPILE-FILE #p"files/ratios.olisp")
(COMPILE-FILE #p"files/richards.olisp")
(COMPILE-FILE #p"files/misc.olisp")
;;; auto-generated from file #p"generate.lisp"
(IN-PACKAGE :CL-USER)
(LOAD #p"defpackage.lisp")
(LOAD (COMPILE-FILE-PATHNAME #p"files/arrays.olisp"))
(LOAD (COMPILE-FILE-PATHNAME #p"files/bignum.olisp"))
(LOAD (COMPILE-FILE-PATHNAME #p"files/boehm-gc.olisp"))
(LOAD (COMPILE-FILE-PATHNAME #p"files/clos.olisp"))
(LOAD (COMPILE-FILE-PATHNAME #p"files/crc40.olisp"))
(LOAD (COMPILE-FILE-PATHNAME #p"files/deflate.olisp"))
(LOAD (COMPILE-FILE-PATHNAME #p"files/gabriel.olisp"))
(LOAD (COMPILE-FILE-PATHNAME #p"files/hash.olisp"))
(LOAD (COMPILE-FILE-PATHNAME #p"files/math.olisp"))
(LOAD (COMPILE-FILE-PATHNAME #p"files/ratios.olisp"))
(LOAD (COMPILE-FILE-PATHNAME #p"files/richards.olisp"))
(LOAD (COMPILE-FILE-PATHNAME #p"files/misc.olisp"))
(COMPILE-FILE #p"support.lisp")
(LOAD (COMPILE-FILE-PATHNAME #p"support.lisp"))
(IN-PACKAGE :CL-BENCH)
(defun run-benchmarks ()
(with-open-file (f (benchmark-report-file)
:direction :output
:if-exists :supersede)
(let ((*benchmark-output* f)
(*print-length* nil)
(*load-verbose* nil)
(*compile-verbose* nil)
(*compile-print* nil))
(bench-report-header)
#-(or gcl armedbear)
(progn
(format t "=== running #<benchmark COMPILER for 3 runs>~%")
(force-output)
(bench-gc)
(bench-report 'cl-bench.misc:run-compiler "COMPILER" 3))
#-(or gcl armedbear ecl)
(progn
(format t "=== running #<benchmark LOAD-FASL for 20 runs>~%")
(force-output)
(bench-gc)
(bench-report 'cl-bench.misc:run-fasload "LOAD-FASL" 20))
#-(or lispworks-personal-edition ecl)
(progn
(format t "=== running #<benchmark SUM-PERMUTATIONS for 2 runs>~%")
(force-output)
(bench-gc)
(bench-report 'cl-bench.misc:run-permutations "SUM-PERMUTATIONS" 2))
#-(or lispworks-personal-edition armedbear)
(progn
(format t "=== running #<benchmark WALK-LIST/SEQ for 2 runs>~%")
(force-output)
(bench-gc)
(funcall 'cl-bench.misc::setup-walk-list/seq)
(bench-report 'cl-bench.misc:walk-list/seq "WALK-LIST/SEQ" 2))
#-(or lispworks-personal-edition armedbear poplog)
(progn
(format t "=== running #<benchmark WALK-LIST/MESS for 1 runs>~%")
(force-output)
(bench-gc)
(funcall 'cl-bench.misc::setup-walk-list/mess)
(bench-report 'cl-bench.misc:walk-list/mess "WALK-LIST/MESS" 1))
(progn
(format t "=== running #<benchmark BOYER for 30 runs>~%")
(force-output)
(bench-gc)
(bench-report 'cl-bench.gabriel:boyer "BOYER" 30))
(progn
(format t "=== running #<benchmark BROWSE for 10 runs>~%")
(force-output)
(bench-gc)
(bench-report 'cl-bench.gabriel:browse "BROWSE" 10))
(progn
(format t "=== running #<benchmark DDERIV for 50 runs>~%")
(force-output)
(bench-gc)
(bench-report 'cl-bench.gabriel:dderiv-run "DDERIV" 50))
(progn
(format t "=== running #<benchmark DERIV for 60 runs>~%")
(force-output)
(bench-gc)
(bench-report 'cl-bench.gabriel:deriv-run "DERIV" 60))
(progn
(format t "=== running #<benchmark DESTRUCTIVE for 100 runs>~%")
(force-output)
(bench-gc)
(bench-report 'cl-bench.gabriel:run-destructive "DESTRUCTIVE" 100))
(progn
(format t "=== running #<benchmark DIV2-TEST-1 for 200 runs>~%")
(force-output)
(bench-gc)
(bench-report 'cl-bench.gabriel:run-div2-test1 "DIV2-TEST-1" 200))
(progn
(format t "=== running #<benchmark DIV2-TEST-2 for 200 runs>~%")
(force-output)
(bench-gc)
(bench-report 'cl-bench.gabriel:run-div2-test2 "DIV2-TEST-2" 200))
(progn
(format t "=== running #<benchmark FFT for 30 runs>~%")
(force-output)
(bench-gc)
(bench-report 'cl-bench.gabriel:run-fft "FFT" 30))
(progn
(format t "=== running #<benchmark FRPOLY/FIXNUM for 100 runs>~%")
(force-output)
(bench-gc)
(bench-report 'cl-bench.gabriel:run-frpoly/fixnum "FRPOLY/FIXNUM" 100))
(progn
(format t "=== running #<benchmark FRPOLY/BIGNUM for 30 runs>~%")
(force-output)
(bench-gc)
(bench-report 'cl-bench.gabriel:run-frpoly/bignum "FRPOLY/BIGNUM" 30))
(progn
(format t "=== running #<benchmark FRPOLY/FLOAT for 100 runs>~%")
(force-output)
(bench-gc)
(bench-report 'cl-bench.gabriel:run-frpoly/float "FRPOLY/FLOAT" 100))
(progn
(format t "=== running #<benchmark PUZZLE for 1500 runs>~%")
(force-output)
(bench-gc)
(bench-report 'cl-bench.gabriel:run-puzzle "PUZZLE" 1500))
(progn
(format t "=== running #<benchmark TAK for 500 runs>~%")
(force-output)
(bench-gc)
(bench-report 'cl-bench.gabriel:run-tak "TAK" 500))
(progn
(format t "=== running #<benchmark CTAK for 900 runs>~%")
(force-output)
(bench-gc)
(bench-report 'cl-bench.gabriel:run-ctak "CTAK" 900))
(progn
(format t "=== running #<benchmark TRTAK for 500 runs>~%")
(force-output)
(bench-gc)
(bench-report 'cl-bench.gabriel:run-trtak "TRTAK" 500))
(progn
(format t "=== running #<benchmark TAKL for 150 runs>~%")
(force-output)
(bench-gc)
(bench-report 'cl-bench.gabriel:run-takl "TAKL" 150))
(progn
(format t "=== running #<benchmark STAK for 200 runs>~%")
(force-output)
(bench-gc)
(bench-report 'cl-bench.gabriel:run-stak "STAK" 200))
(progn
(format t "=== running #<benchmark FPRINT/UGLY for 200 runs>~%")
(force-output)
(bench-gc)
(bench-report 'cl-bench.gabriel:fprint/ugly "FPRINT/UGLY" 200))
(progn
(format t "=== running #<benchmark FPRINT/PRETTY for 100 runs>~%")
(force-output)
(bench-gc)
(bench-report 'cl-bench.gabriel:fprint/pretty "FPRINT/PRETTY" 100))
(progn
(format t "=== running #<benchmark TRAVERSE for 15 runs>~%")
(force-output)
(bench-gc)
(bench-report 'cl-bench.gabriel:run-traverse "TRAVERSE" 15))
(progn
(format t "=== running #<benchmark TRIANGLE for 5 runs>~%")
(force-output)
(bench-gc)
(bench-report 'cl-bench.gabriel:run-triangle "TRIANGLE" 5))
(progn
(format t "=== running #<benchmark RICHARDS for 5 runs>~%")
(force-output)
(bench-gc)
(bench-report 'cl-bench.richards:richards "RICHARDS" 5))
(progn
(format t "=== running #<benchmark FACTORIAL for 1000 runs>~%")
(force-output)
(bench-gc)
(bench-report 'cl-bench.math:run-factorial "FACTORIAL" 1000))
(progn
(format t "=== running #<benchmark FIB for 50 runs>~%")
(force-output)
(bench-gc)
(bench-report 'cl-bench.math:run-fib "FIB" 50))
(progn
(format t "=== running #<benchmark FIB-RATIO for 500 runs>~%")
(force-output)
(bench-gc)
(bench-report 'cl-bench.math:run-fib-ratio "FIB-RATIO" 500))
(progn
(format t "=== running #<benchmark ACKERMANN for 1 runs>~%")
(force-output)
(bench-gc)
(bench-report 'cl-bench.math:run-ackermann "ACKERMANN" 1))
(progn
(format t "=== running #<benchmark MANDELBROT/COMPLEX for 100 runs>~%")
(force-output)
(bench-gc)
(bench-report 'cl-bench.math:run-mandelbrot/complex "MANDELBROT/COMPLEX" 100))
(progn
(format t "=== running #<benchmark MANDELBROT/DFLOAT for 100 runs>~%")
(force-output)
(bench-gc)
(bench-report 'cl-bench.math:run-mandelbrot/dfloat "MANDELBROT/DFLOAT" 100))
(progn
(format t "=== running #<benchmark MRG32K3A for 20 runs>~%")
(force-output)
(bench-gc)
(bench-report 'cl-bench.math:run-mrg32k3a "MRG32K3A" 20))
(progn
(format t "=== running #<benchmark CRC40 for 2 runs>~%")
(force-output)
(bench-gc)
(bench-report 'cl-bench.crc:run-crc40 "CRC40" 2))
(progn
(format t "=== running #<benchmark BIGNUM/ELEM-100-1000 for 1 runs>~%")
(force-output)
(bench-gc)
(bench-report 'cl-bench.bignum:run-elem-100-1000 "BIGNUM/ELEM-100-1000" 1))
(progn
(format t "=== running #<benchmark BIGNUM/ELEM-1000-100 for 1 runs>~%")
(force-output)
(bench-gc)
(bench-report 'cl-bench.bignum:run-elem-1000-100 "BIGNUM/ELEM-1000-100" 1))
(progn
(format t "=== running #<benchmark BIGNUM/ELEM-10000-1 for 1 runs>~%")
(force-output)
(bench-gc)
(bench-report 'cl-bench.bignum:run-elem-10000-1 "BIGNUM/ELEM-10000-1" 1))
(progn
(format t "=== running #<benchmark BIGNUM/PARI-100-10 for 1 runs>~%")
(force-output)
(bench-gc)
(bench-report 'cl-bench.bignum:run-pari-100-10 "BIGNUM/PARI-100-10" 1))
(progn
(format t "=== running #<benchmark BIGNUM/PARI-200-5 for 1 runs>~%")
(force-output)
(bench-gc)
(bench-report 'cl-bench.bignum:run-pari-200-5 "BIGNUM/PARI-200-5" 1))
(progn
(format t "=== running #<benchmark PI-DECIMAL/SMALL for 100 runs>~%")
(force-output)
(bench-gc)
(bench-report 'cl-bench.bignum:run-pi-decimal/small "PI-DECIMAL/SMALL" 100))
(progn
(format t "=== running #<benchmark PI-DECIMAL/BIG for 2 runs>~%")
(force-output)
(bench-gc)
(bench-report 'cl-bench.bignum:run-pi-decimal/big "PI-DECIMAL/BIG" 2))
(progn
(format t "=== running #<benchmark PI-ATAN for 200 runs>~%")
(force-output)
(bench-gc)
(bench-report 'cl-bench.bignum:run-pi-atan "PI-ATAN" 200))
(progn
(format t "=== running #<benchmark PI-RATIOS for 2 runs>~%")
(force-output)
(bench-gc)
(bench-report 'cl-bench.ratios:run-pi-ratios "PI-RATIOS" 2))
(progn
(format t "=== running #<benchmark HASH-STRINGS for 2 runs>~%")
(force-output)
(bench-gc)
(bench-report 'cl-bench.hash:hash-strings "HASH-STRINGS" 2))
(progn
(format t "=== running #<benchmark HASH-INTEGERS for 10 runs>~%")
(force-output)
(bench-gc)
(bench-report 'cl-bench.hash:hash-integers "HASH-INTEGERS" 10))
(progn
(format t "=== running #<benchmark SLURP-LINES for 30 runs>~%")
(force-output)
(bench-gc)
(bench-report 'cl-bench.hash:run-slurp-lines "SLURP-LINES" 30))
#-(or lispworks-personal-edition)
(progn
(format t "=== running #<benchmark BOEHM-GC for 1 runs>~%")
(force-output)
(bench-gc)
(bench-report 'cl-bench.boehm-gc:gc-benchmark "BOEHM-GC" 1))
(progn
(format t "=== running #<benchmark DEFLATE-FILE for 100 runs>~%")
(force-output)
(bench-gc)
(bench-report 'cl-bench.deflate:run-deflate-file "DEFLATE-FILE" 100))
#-(or lispworks-personal-edition)
(progn
(format t "=== running #<benchmark 1D-ARRAYS for 1 runs>~%")
(force-output)
(bench-gc)
(bench-report 'cl-bench.arrays:bench-1d-arrays "1D-ARRAYS" 1))
#-(or lispworks-personal-edition)
(progn
(format t "=== running #<benchmark 2D-ARRAYS for 1 runs>~%")
(force-output)
(bench-gc)
(bench-report 'cl-bench.arrays:bench-2d-arrays "2D-ARRAYS" 1))
#-(or lispworks-personal-edition)
(progn
(format t "=== running #<benchmark 3D-ARRAYS for 1 runs>~%")
(force-output)
(bench-gc)
(bench-report 'cl-bench.arrays:bench-3d-arrays "3D-ARRAYS" 1))
(progn
(format t "=== running #<benchmark BITVECTORS for 3 runs>~%")
(force-output)
(bench-gc)
(bench-report 'cl-bench.arrays:bench-bitvectors "BITVECTORS" 3))
#-(or lispworks-personal-edition)
(progn
(format t "=== running #<benchmark BENCH-STRINGS for 1 runs>~%")
(force-output)
(bench-gc)
(bench-report 'cl-bench.arrays:bench-strings "BENCH-STRINGS" 1))
#-(or lispworks-personal-edition)
(progn
(format t "=== running #<benchmark fill-strings/adjustable for 1 runs>~%")
(force-output)
(bench-gc)
(bench-report 'cl-bench.arrays:bench-strings/adjustable "fill-strings/adjustable" 1))
#-(or allegro lispworks-personal-edition poplog)
(progn
(format t "=== running #<benchmark STRING-CONCAT for 1 runs>~%")
(force-output)
(bench-gc)
(bench-report 'cl-bench.arrays:bench-string-concat "STRING-CONCAT" 1))
#-(or lispworks-personal-edition)
(progn
(format t "=== running #<benchmark SEARCH-SEQUENCE for 1 runs>~%")
(force-output)
(bench-gc)
(bench-report 'cl-bench.arrays:bench-search-sequence "SEARCH-SEQUENCE" 1))
(progn
(format t "=== running #<benchmark CLOS/defclass for 1 runs>~%")
(force-output)
(bench-gc)
(bench-report 'cl-bench.clos:run-defclass "CLOS/defclass" 1))
(progn
(format t "=== running #<benchmark CLOS/defmethod for 1 runs>~%")
(force-output)
(bench-gc)
(bench-report 'cl-bench.clos:run-defmethod "CLOS/defmethod" 1))
(progn
(format t "=== running #<benchmark CLOS/instantiate for 2 runs>~%")
(force-output)
(bench-gc)
(bench-report 'cl-bench.clos:make-instances "CLOS/instantiate" 2))
(progn
(format t "=== running #<benchmark CLOS/simple-instantiate for 200 runs>~%")
(force-output)
(bench-gc)
(bench-report 'cl-bench.clos:make-instances/simple "CLOS/simple-instantiate" 200))
(progn
(format t "=== running #<benchmark CLOS/methodcalls for 5 runs>~%")
(force-output)
(bench-gc)
(bench-report 'cl-bench.clos:methodcalls/simple "CLOS/methodcalls" 5))
(progn
(format t "=== running #<benchmark CLOS/method+after for 2 runs>~%")
(force-output)
(bench-gc)
(bench-report 'cl-bench.clos:methodcalls/simple+after "CLOS/method+after" 2))
#-(or clisp poplog)
(progn
(format t "=== running #<benchmark CLOS/complex-methods for 5 runs>~%")
(force-output)
(bench-gc)
(bench-report 'cl-bench.clos:methodcalls/complex "CLOS/complex-methods" 5))
(progn
(format t "=== running #<benchmark EQL-SPECIALIZED-FIB for 2 runs>~%")
(force-output)
(bench-gc)
(bench-report 'cl-bench.clos:run-eql-fib "EQL-SPECIALIZED-FIB" 2))
(bench-report-footer))))
(run-benchmarks)
;;; auto-generated from file #p"generate.lisp"
(IN-PACKAGE :CL-USER)
(LOAD #p"defpackage.lisp")
(LOAD #p"files/arrays.olisp")
(LOAD #p"files/bignum.olisp")
(LOAD #p"files/boehm-gc.olisp")
(LOAD #p"files/clos.olisp")
(LOAD #p"files/crc40.olisp")
(LOAD #p"files/deflate.olisp")
(LOAD #p"files/gabriel.olisp")
(LOAD #p"files/hash.olisp")
(LOAD #p"files/math.olisp")
(LOAD #p"files/ratios.olisp")
(LOAD #p"files/richards.olisp")
(LOAD #p"files/misc.olisp")
(LOAD #p"support.lisp")
(IN-PACKAGE :CL-BENCH)
(defun run-benchmarks ()
(with-open-file (f (benchmark-report-file)
:direction :output
:if-exists :supersede)
(let ((*benchmark-output* f)
(*print-length* nil)
(*load-verbose* nil)
(*compile-verbose* nil)
(*compile-print* nil))
(bench-report-header)
#-(or gcl armedbear)
(progn
(format t "=== running #<benchmark COMPILER for 3 runs>~%")
(force-output)
(bench-gc)
(bench-report 'cl-bench.misc:run-compiler "COMPILER" 3))
#-(or gcl armedbear ecl)
(progn
(format t "=== running #<benchmark LOAD-FASL for 20 runs>~%")
(force-output)
(bench-gc)
(bench-report 'cl-bench.misc:run-fasload "LOAD-FASL" 20))
#-(or lispworks-personal-edition ecl)
(progn
(format t "=== running #<benchmark SUM-PERMUTATIONS for 2 runs>~%")
(force-output)
(bench-gc)
(bench-report 'cl-bench.misc:run-permutations "SUM-PERMUTATIONS" 2))
#-(or lispworks-personal-edition armedbear)
(progn
(format t "=== running #<benchmark WALK-LIST/SEQ for 2 runs>~%")
(force-output)
(bench-gc)
(funcall 'cl-bench.misc::setup-walk-list/seq)
(bench-report 'cl-bench.misc:walk-list/seq "WALK-LIST/SEQ" 2))
#-(or lispworks-personal-edition armedbear poplog)
(progn
(format t "=== running #<benchmark WALK-LIST/MESS for 1 runs>~%")
(force-output)
(bench-gc)
(funcall 'cl-bench.misc::setup-walk-list/mess)
(bench-report 'cl-bench.misc:walk-list/mess "WALK-LIST/MESS" 1))
(progn
(format t "=== running #<benchmark BOYER for 30 runs>~%")
(force-output)
(bench-gc)
(bench-report 'cl-bench.gabriel:boyer "BOYER" 30))
(progn
(format t "=== running #<benchmark BROWSE for 10 runs>~%")
(force-output)
(bench-gc)
(bench-report 'cl-bench.gabriel:browse "BROWSE" 10))
(progn
(format t "=== running #<benchmark DDERIV for 50 runs>~%")
(force-output)
(bench-gc)
(bench-report 'cl-bench.gabriel:dderiv-run "DDERIV" 50))
(progn
(format t "=== running #<benchmark DERIV for 60 runs>~%")
(force-output)
(bench-gc)
(bench-report 'cl-bench.gabriel:deriv-run "DERIV" 60))
(progn
(format t "=== running #<benchmark DESTRUCTIVE for 100 runs>~%")
(force-output)
(bench-gc)
(bench-report 'cl-bench.gabriel:run-destructive "DESTRUCTIVE" 100))
(progn
(format t "=== running #<benchmark DIV2-TEST-1 for 200 runs>~%")
(force-output)
(bench-gc)
(bench-report 'cl-bench.gabriel:run-div2-test1 "DIV2-TEST-1" 200))
(progn
(format t "=== running #<benchmark DIV2-TEST-2 for 200 runs>~%")
(force-output)
(bench-gc)
(bench-report 'cl-bench.gabriel:run-div2-test2 "DIV2-TEST-2" 200))
(progn
(format t "=== running #<benchmark FFT for 30 runs>~%")
(force-output)
(bench-gc)
(bench-report 'cl-bench.gabriel:run-fft "FFT" 30))
(progn
(format t "=== running #<benchmark FRPOLY/FIXNUM for 100 runs>~%")
(force-output)
(bench-gc)
(bench-report 'cl-bench.gabriel:run-frpoly/fixnum "FRPOLY/FIXNUM" 100))
(progn
(format t "=== running #<benchmark FRPOLY/BIGNUM for 30 runs>~%")
(force-output)
(bench-gc)
(bench-report 'cl-bench.gabriel:run-frpoly/bignum "FRPOLY/BIGNUM" 30))
(progn
(format t "=== running #<benchmark FRPOLY/FLOAT for 100 runs>~%")
(force-output)
(bench-gc)
(bench-report 'cl-bench.gabriel:run-frpoly/float "FRPOLY/FLOAT" 100))
(progn
(format t "=== running #<benchmark PUZZLE for 1500 runs>~%")
(force-output)
(bench-gc)
(bench-report 'cl-bench.gabriel:run-puzzle "PUZZLE" 1500))
(progn
(format t "=== running #<benchmark TAK for 500 runs>~%")
(force-output)
(bench-gc)
(bench-report 'cl-bench.gabriel:run-tak "TAK" 500))
(progn
(format t "=== running #<benchmark CTAK for 900 runs>~%")
(force-output)
(bench-gc)
(bench-report 'cl-bench.gabriel:run-ctak "CTAK" 900))
(progn
(format t "=== running #<benchmark TRTAK for 500 runs>~%")
(force-output)
(bench-gc)
(bench-report 'cl-bench.gabriel:run-trtak "TRTAK" 500))
(progn
(format t "=== running #<benchmark TAKL for 150 runs>~%")
(force-output)
(bench-gc)
(bench-report 'cl-bench.gabriel:run-takl "TAKL" 150))
(progn
(format t "=== running #<benchmark STAK for 200 runs>~%")
(force-output)
(bench-gc)
(bench-report 'cl-bench.gabriel:run-stak "STAK" 200))
(progn
(format t "=== running #<benchmark FPRINT/UGLY for 200 runs>~%")
(force-output)
(bench-gc)
(bench-report 'cl-bench.gabriel:fprint/ugly "FPRINT/UGLY" 200))
(progn
(format t "=== running #<benchmark FPRINT/PRETTY for 100 runs>~%")
(force-output)
(bench-gc)
(bench-report 'cl-bench.gabriel:fprint/pretty "FPRINT/PRETTY" 100))
(progn
(format t "=== running #<benchmark TRAVERSE for 15 runs>~%")
(force-output)
(bench-gc)
(bench-report 'cl-bench.gabriel:run-traverse "TRAVERSE" 15))
(progn
(format t "=== running #<benchmark TRIANGLE for 5 runs>~%")
(force-output)
(bench-gc)
(bench-report 'cl-bench.gabriel:run-triangle "TRIANGLE" 5))
(progn
(format t "=== running #<benchmark RICHARDS for 5 runs>~%")
(force-output)
(bench-gc)
(bench-report 'cl-bench.richards:richards "RICHARDS" 5))
(progn
(format t "=== running #<benchmark FACTORIAL for 1000 runs>~%")
(force-output)
(bench-gc)
(bench-report 'cl-bench.math:run-factorial "FACTORIAL" 1000))
(progn
(format t "=== running #<benchmark FIB for 50 runs>~%")
(force-output)
(bench-gc)
(bench-report 'cl-bench.math:run-fib "FIB" 50))
(progn
(format t "=== running #<benchmark FIB-RATIO for 500 runs>~%")
(force-output)
(bench-gc)
(bench-report 'cl-bench.math:run-fib-ratio "FIB-RATIO" 500))
(progn
(format t "=== running #<benchmark ACKERMANN for 1 runs>~%")
(force-output)
(bench-gc)
(bench-report 'cl-bench.math:run-ackermann "ACKERMANN" 1))
(progn
(format t "=== running #<benchmark MANDELBROT/COMPLEX for 100 runs>~%")
(force-output)
(bench-gc)
(bench-report 'cl-bench.math:run-mandelbrot/complex "MANDELBROT/COMPLEX" 100))
(progn
(format t "=== running #<benchmark MANDELBROT/DFLOAT for 100 runs>~%")
(force-output)
(bench-gc)
(bench-report 'cl-bench.math:run-mandelbrot/dfloat "MANDELBROT/DFLOAT" 100))
(progn
(format t "=== running #<benchmark MRG32K3A for 20 runs>~%")
(force-output)
(bench-gc)
(bench-report 'cl-bench.math:run-mrg32k3a "MRG32K3A" 20))
(progn
(format t "=== running #<benchmark CRC40 for 2 runs>~%")
(force-output)
(bench-gc)
(bench-report 'cl-bench.crc:run-crc40 "CRC40" 2))
(progn
(format t "=== running #<benchmark BIGNUM/ELEM-100-1000 for 1 runs>~%")
(force-output)
(bench-gc)
(bench-report 'cl-bench.bignum:run-elem-100-1000 "BIGNUM/ELEM-100-1000" 1))
(progn
(format t "=== running #<benchmark BIGNUM/ELEM-1000-100 for 1 runs>~%")
(force-output)
(bench-gc)
(bench-report 'cl-bench.bignum:run-elem-1000-100 "BIGNUM/ELEM-1000-100" 1))
(progn
(format t "=== running #<benchmark BIGNUM/ELEM-10000-1 for 1 runs>~%")
(force-output)
(bench-gc)
(bench-report 'cl-bench.bignum:run-elem-10000-1 "BIGNUM/ELEM-10000-1" 1))
(progn
(format t "=== running #<benchmark BIGNUM/PARI-100-10 for 1 runs>~%")
(force-output)
(bench-gc)
(bench-report 'cl-bench.bignum:run-pari-100-10 "BIGNUM/PARI-100-10" 1))
(progn
(format t "=== running #<benchmark BIGNUM/PARI-200-5 for 1 runs>~%")
(force-output)
(bench-gc)
(bench-report 'cl-bench.bignum:run-pari-200-5 "BIGNUM/PARI-200-5" 1))
(progn
(format t "=== running #<benchmark PI-DECIMAL/SMALL for 100 runs>~%")
(force-output)
(bench-gc)
(bench-report 'cl-bench.bignum:run-pi-decimal/small "PI-DECIMAL/SMALL" 100))
(progn
(format t "=== running #<benchmark PI-DECIMAL/BIG for 2 runs>~%")
(force-output)
(bench-gc)
(bench-report 'cl-bench.bignum:run-pi-decimal/big "PI-DECIMAL/BIG" 2))
(progn
(format t "=== running #<benchmark PI-ATAN for 200 runs>~%")
(force-output)
(bench-gc)
(bench-report 'cl-bench.bignum:run-pi-atan "PI-ATAN" 200))
(progn
(format t "=== running #<benchmark PI-RATIOS for 2 runs>~%")
(force-output)
(bench-gc)
(bench-report 'cl-bench.ratios:run-pi-ratios "PI-RATIOS" 2))
(progn
(format t "=== running #<benchmark HASH-STRINGS for 2 runs>~%")
(force-output)
(bench-gc)
(bench-report 'cl-bench.hash:hash-strings "HASH-STRINGS" 2))
(progn
(format t "=== running #<benchmark HASH-INTEGERS for 10 runs>~%")
(force-output)
(bench-gc)
(bench-report 'cl-bench.hash:hash-integers "HASH-INTEGERS" 10))
(progn
(format t "=== running #<benchmark SLURP-LINES for 30 runs>~%")
(force-output)
(bench-gc)
(bench-report 'cl-bench.hash:run-slurp-lines "SLURP-LINES" 30))
#-(or lispworks-personal-edition)
(progn
(format t "=== running #<benchmark BOEHM-GC for 1 runs>~%")
(force-output)
(bench-gc)
(bench-report 'cl-bench.boehm-gc:gc-benchmark "BOEHM-GC" 1))
(progn
(format t "=== running #<benchmark DEFLATE-FILE for 100 runs>~%")
(force-output)
(bench-gc)
(bench-report 'cl-bench.deflate:run-deflate-file "DEFLATE-FILE" 100))
#-(or lispworks-personal-edition)
(progn
(format t "=== running #<benchmark 1D-ARRAYS for 1 runs>~%")
(force-output)
(bench-gc)
(bench-report 'cl-bench.arrays:bench-1d-arrays "1D-ARRAYS" 1))
#-(or lispworks-personal-edition)
(progn
(format t "=== running #<benchmark 2D-ARRAYS for 1 runs>~%")
(force-output)
(bench-gc)
(bench-report 'cl-bench.arrays:bench-2d-arrays "2D-ARRAYS" 1))
#-(or lispworks-personal-edition)
(progn
(format t "=== running #<benchmark 3D-ARRAYS for 1 runs>~%")
(force-output)
(bench-gc)
(bench-report 'cl-bench.arrays:bench-3d-arrays "3D-ARRAYS" 1))
(progn
(format t "=== running #<benchmark BITVECTORS for 3 runs>~%")
(force-output)
(bench-gc)
(bench-report 'cl-bench.arrays:bench-bitvectors "BITVECTORS" 3))
#-(or lispworks-personal-edition)
(progn
(format t "=== running #<benchmark BENCH-STRINGS for 1 runs>~%")
(force-output)
(bench-gc)
(bench-report 'cl-bench.arrays:bench-strings "BENCH-STRINGS" 1))
#-(or lispworks-personal-edition)
(progn
(format t "=== running #<benchmark fill-strings/adjustable for 1 runs>~%")
(force-output)
(bench-gc)
(bench-report 'cl-bench.arrays:bench-strings/adjustable "fill-strings/adjustable" 1))
#-(or allegro lispworks-personal-edition poplog)
(progn
(format t "=== running #<benchmark STRING-CONCAT for 1 runs>~%")
(force-output)
(bench-gc)
(bench-report 'cl-bench.arrays:bench-string-concat "STRING-CONCAT" 1))
#-(or lispworks-personal-edition)
(progn
(format t "=== running #<benchmark SEARCH-SEQUENCE for 1 runs>~%")
(force-output)
(bench-gc)
(bench-report 'cl-bench.arrays:bench-search-sequence "SEARCH-SEQUENCE" 1))
(progn
(format t "=== running #<benchmark CLOS/defclass for 1 runs>~%")
(force-output)
(bench-gc)
(bench-report 'cl-bench.clos:run-defclass "CLOS/defclass" 1))
(progn
(format t "=== running #<benchmark CLOS/defmethod for 1 runs>~%")
(force-output)
(bench-gc)
(bench-report 'cl-bench.clos:run-defmethod "CLOS/defmethod" 1))
(progn
(format t "=== running #<benchmark CLOS/instantiate for 2 runs>~%")
(force-output)
(bench-gc)
(bench-report 'cl-bench.clos:make-instances "CLOS/instantiate" 2))
(progn
(format t "=== running #<benchmark CLOS/simple-instantiate for 200 runs>~%")
(force-output)
(bench-gc)
(bench-report 'cl-bench.clos:make-instances/simple "CLOS/simple-instantiate" 200))
(progn
(format t "=== running #<benchmark CLOS/methodcalls for 5 runs>~%")
(force-output)
(bench-gc)
(bench-report 'cl-bench.clos:methodcalls/simple "CLOS/methodcalls" 5))
(progn
(format t "=== running #<benchmark CLOS/method+after for 2 runs>~%")
(force-output)
(bench-gc)
(bench-report 'cl-bench.clos:methodcalls/simple+after "CLOS/method+after" 2))
#-(or clisp poplog)
(progn
(format t "=== running #<benchmark CLOS/complex-methods for 5 runs>~%")
(force-output)
(bench-gc)
(bench-report 'cl-bench.clos:methodcalls/complex "CLOS/complex-methods" 5))
(progn
(format t "=== running #<benchmark EQL-SPECIALIZED-FIB for 2 runs>~%")
(force-output)
(bench-gc)
(bench-report 'cl-bench.clos:run-eql-fib "EQL-SPECIALIZED-FIB" 2))
(bench-report-footer))))
(run-benchmarks)
/arrays.olisp
/bignum.olisp
/boehm-gc.olisp
/clos-janderson.olisp
/clos.olisp
/crc40.olisp
/deflate.olisp
/gabriel.olisp
/hash.olisp
/math.olisp
/misc.olisp
/ratios.olisp
/richards.olisp
;; benchmarks speed of array and sequence operations
;;
;; Author: Eric Marsden <emarsden@laas.fr>
;; Time-stamp: <2003-12-29 emarsden>
;;
;;
;; Timing tests for creation, initialization, access and garbage
;; collection for arrays, vectors, bitvectors and strings.
;;
;; NOTE: be careful running these in CMUCL on Linux with sizes larger
;; than your RAM; you will most likely crash your machine.
(in-package :cl-bench.arrays)
(defun bench-1d-arrays (&optional (size 100000) (runs 10))
(declare (fixnum size))
(let ((ones (make-array size :element-type '(integer 0 1000) :initial-element 1))
(twos (make-array size :element-type '(integer 0 1000) :initial-element 2))
(threes (make-array size :element-type '(integer 0 2000))))
(dotimes (runs runs)
(dotimes (pos size)
(setf (aref threes pos) (+ (aref ones pos) (aref twos pos))))
(assert (null (search (list 4 5 6) threes)))))
(values))
(defun bench-2d-arrays (&optional (size 2000) (runs 10))
(declare (fixnum size))
(let ((ones (make-array (list size size) :element-type '(integer 0 1000) :initial-element 1))
(twos (make-array (list size size) :element-type '(integer 0 1000) :initial-element 2))
(threes (make-array (list size size) :element-type '(integer 0 2000))))
(dotimes (runs runs)
(dotimes (i size)
(dotimes (j size)
(setf (aref threes i j)
(+ (aref ones i j) (aref twos i j)))))
(assert (eql 3 (aref threes 3 3)))))
(values))
(defun bench-3d-arrays (&optional (size 200) (runs 10))
(declare (fixnum size))
(let ((ones (make-array (list size size size) :element-type '(integer 0 1000) :initial-element 1))
(twos (make-array (list size size size) :element-type '(integer 0 1000) :initial-element 2))
(threes (make-array (list size size size) :element-type '(integer 0 2000))))
(dotimes (runs runs)
(dotimes (i size)
(dotimes (j size)
(dotimes (k size)
(setf (aref threes i j k)
(+ (aref ones i j k) (aref twos i j k))))))
(assert (eql 3 (aref threes 3 3 3)))))
(values))
(defun bench-bitvectors (&optional (size 1000000) (runs 700))
(declare (fixnum size))
(let ((zeros (make-array size :element-type 'bit :initial-element 0))
(ones (make-array size :element-type 'bit :initial-element 1))
(xors (make-array size :element-type 'bit)))
(dotimes (runs runs)
(bit-xor zeros ones xors)
(bit-nand zeros ones xors)
(bit-and zeros xors)))
(values))
(defun bench-strings (&optional (size 1000000) (runs 50))
(declare (fixnum size))
(let ((zzz (make-string size :initial-element #\z))
(xxx (make-string size)))
(dotimes (runs runs)
(and (fill xxx #\x)
(replace xxx zzz)
(search "xxxd" xxx)
(nstring-upcase xxx))))
(values))
(defun bench-strings/adjustable (&optional (size 1000000) (runs 100))
(declare (fixnum size))
(dotimes (runs runs)
(let ((sink (make-array 10 :element-type 'character :adjustable t :fill-pointer 0)))
(dotimes (i size)
(vector-push-extend (code-char (mod i 128)) sink))))
(values))
;; certain implementations such as OpenMCL have an array (and thus
;; string) length limit of (expt 2 24), so don't try this on humungous
;; sizes
(defun bench-string-concat (&optional (size 1000000) (runs 100))
(declare (fixnum size))
(dotimes (runs runs)
(let ((len (length
(with-output-to-string (string)
(dotimes (i size)
(write-sequence "hi there!" string))))))
(assert (eql len (* size (length "hi there!")))))
(values)))
(defun bench-search-sequence (&optional (size 1000000) (runs 10))
(declare (fixnum size))
(let ((haystack (make-array size :element-type '(integer 0 1000))))
(dotimes (runs runs)
(dotimes (i size)
(setf (aref haystack i) (mod i 1000)))
(assert (null (find -1 haystack :test #'=)))
(assert (null (find-if #'minusp haystack)))
(assert (null (position -1 haystack :test #'= :from-end t)))
(loop :for i :from 20 :to 900 :by 20
:do (assert (eql i (position i haystack :test #'=))))
(assert (eql 0 (search #(0 1 2 3 4) haystack :end2 1000 :from-end t)))))
(values))
;; EOF
;;; bignum.lisp -- bignum operations from Bruno Haible
;;
;; Time-stamp: <2004-01-09 emarsden>
;;
;; code from Bruno Haible <haible@ilog.fr>
;;
;; A. Elementary integer computations:
;; The tests are run with N = 100, 1000, 10000, 100000 decimal digits.
;; Precompute *x1* = floor((sqrt(5)+1)/2 * 10^(2N))
;; *x2* = floor(sqrt(3) * 10^N)
;; *x3* = 10^N+1
;; Then time the following operations:
;; 1. Multiplication *x1* * *x2*,
;; 2. Division (with remainder) *x1* / *x2*,
;; 3. integer_sqrt (*x3*),
;; 4. gcd (*x1*, *x2*),
;;
;; B. (from Pari)
;; u=1;v=1;p=1;q=1;for(k=1..1000){w=u+v;u=v;v=w;p=p*w;q=lcm(q,w);}
(in-package :cl-bench.bignum)
(defvar *x1*)
(defvar *x2*)
(defvar *x3*)
(defvar *y*)
(defvar *z*)
;; this can be 1e-6 on most compilers, but for COMPUTE-PI-DECIMAL on
;; OpenMCL we lose lotsa precision
(defun fuzzy-eql (a b)
(< (abs (/ (- a b) b)) 1e-4))
(defun elementary-benchmark (N repeat)
(setq *x1* (floor (+ (isqrt (* 5 (expt 10 (* 4 N)))) (expt 10 (* 2 N))) 2))
(setq *x2* (isqrt (* 3 (expt 10 (* 2 N)))))
(setq *x3* (+ (expt 10 N) 1))
;; (format t "~&~%N = ~D, Multiplication *x1* * *x2*, divide times by ~D~%" N repeat)
(dotimes (count 3)
(dotimes (_ repeat)
(setq *y* (* *x1* *x2*))))
;; (format t "~&~%N = ~D, Division (with remainder) *x1* / *x2*, divide times by ~D~%" N repeat)
(dotimes (count 3)
(dotimes (_ repeat)
(multiple-value-setq (*y* *z*) (floor *x1* *x2*))))
;; (format t "~&~%N = ~D, integer_sqrt(*x3*), divide times by ~D~%" N repeat)
(dotimes (count 3)
(dotimes (_ repeat)
(setq *y* (isqrt *x3*))))
;; (format t "~&~%N = ~D, gcd(*x1*,*x2*), divide times by ~D~%" N repeat)
(dotimes (count 3)
(dotimes (_ repeat)
(setq *y* (gcd *x1* *x2*)))))
(defun run-elem-100-1000 ()
(elementary-benchmark 100 1000))
(defun run-elem-1000-100 ()
(elementary-benchmark 1000 100))
(defun run-elem-10000-1 ()
(elementary-benchmark 10000 1))
(defun pari-benchmark (N repeat)
(dotimes (count 3)
(dotimes (_ repeat)
(let ((u 1) (v 1) (p 1) (q 1))
(do ((k 1 (1+ k)))
((> k N) (setq *y* p *z* q))
(let ((w (+ u v)))
(shiftf u v w)
(setq p (* p w))
(setq q (lcm q w))))))))
(defun run-pari-100-10 ()
(pari-benchmark 100 10))
(defun run-pari-200-5 ()
(pari-benchmark 200 5))
(defun run-pari-1000-1 ()
(pari-benchmark 1000 1))
;; calculating pi using ratios
(defun compute-pi-decimal (n)
(let ((p 0)
(r nil)
(dpi 0))
(dotimes (i n)
(incf p (/ (- (/ 4 (+ 1 (* 8 i)))
(/ 2 (+ 4 (* 8 i)))
(/ 1 (+ 5 (* 8 i)))
(/ 1 (+ 6 (* 8 i))))
(expt 16 i))))
(dotimes (i n)
(multiple-value-setq (r p) (truncate p 10))
(setf dpi (+ (* 10 dpi) r))
(setf p (* p 10)))
dpi))
(defun run-pi-decimal/small ()
(assert (fuzzy-eql pi (/ (compute-pi-decimal 200) (expt 10 198)))))
(defun run-pi-decimal/big ()
(assert (fuzzy-eql pi (/ (compute-pi-decimal 1000) (expt 10 998)))))
(defun pi-atan (k n)
(do* ((a 0) (w (* n k)) (k2 (* k k)) (i -1))
((= w 0) a)
(setq w (truncate w k2))
(incf i 2)
(incf a (truncate w i))
(setq w (truncate w k2))
(incf i 2)
(decf a (truncate w i))))
(defun calc-pi-atan (digits)
(let* ((n digits)
(m (+ n 3))
(tenpower (expt 10 m)))
(values (truncate (- (+ (pi-atan 18 (* tenpower 48))
(pi-atan 57 (* tenpower 32)))
(pi-atan 239 (* tenpower 20)))
1000))))
(defun run-pi-atan ()
(let ((api (calc-pi-atan 1000)))
(assert (fuzzy-eql pi (/ api (expt 10 1000))))))
;; EOF