performance testing - Why is this lisp benchmark (in sbcl) so slow? -


since i’m interested in c++ in lisp, tried reproduce benchmark presented here written guillaume michel. benchmark daxpy blas level 1 operation performed multiple times on big arrays. full code thankfully posted on github , in both languages 1 page.

sadly, discovered not possible me reach velocity of calculations lisp.

for linux, got similar results c++ lisp:

size | c++ | common lisp

100,000,000 | 181.73 | 183.9

the numbers differ (naturally) both on pc:

size | c++ | common lisp

100,000,000 | 195.41 | 3544.3

since wanted additional measurement, started both programs time command , got (shortened up):

$ time ./saxpy real    0m7.381s $ time ./saxpy_lisp real    0m40.661s 

i assumed different reasons blatant difference. scanned through both code samples, found no big algorithmic or numeric difference between c++ , lisp version. thought, usage of buildapp created delay, started benchmark directly in repl. last resort try version of sbcl, downloaded newest sbcl-1.3.11 , evaluated there – still (optimized) lisp version needs longer it’s c++ counterpart.

what missing?

i cannot replicate findings:

sylwester@pus:~/a/bench-saxpy:master$ sbcl --dynamic-space-size 14000 sbcl 1.3.1.debian, implementation of ansi common lisp. more information sbcl available @ <http://www.sbcl.org/>.  sbcl free software, provided is, absolutely no warranty. in public domain; portions provided under bsd-style licenses.  see credits , copying files in distribution more information. * (compile-file "saxpy.lisp")  ; compiling file "/pussycat/natty-home/westerp/apps/bench-saxpy/saxpy.lisp" (written 06 nov 2016 12:04:30 am): ; compiling (defun saxpy ...) ; compiling (defun daxpy ...) ; compiling (defmacro timing ...) ; compiling (defun bench ...) ; compiling (defun main ...)  ; /pussycat/natty-home/westerp/apps/bench-saxpy/saxpy.fasl written ; compilation finished in 0:00:00.038 #p"/pussycat/natty-home/westerp/apps/bench-saxpy/saxpy.fasl" nil nil * (load "saxpy.fasl")  t * (main t) size, execution time (ms) 10, 0.0 100, 0.0 1000, 0.0 10000, 0.1 100000, 0.49999997 1000000, 3.6 10000000, 39.2 100000000, 346.30002 (nil nil nil nil nil nil nil nil) 

so on machine took 346ms (relatively old machine). whole test took 5 seconds series of many tests. interesting running sbcl faster making image , running it:

sylwester@pus:~/a/bench-saxpy:master$ make lisp buildapp --output saxpy_lisp --entry main --load saxpy.lisp --dynamic-space-size 14000 ;; loading file #p"/pussycat/natty-home/westerp/apps/bench-saxpy/saxpy.lisp" [undoing binding stack , other enclosing state... done] [saving current lisp image saxpy_lisp: writing 4944 bytes read-only space @ 0x20000000 writing 3168 bytes static space @ 0x20100000 writing 60522496 bytes dynamic space @ 0x1000000000 done] sylwester@pus:~/a/bench-saxpy:master$ ./saxpy_lisp  size, execution time (ms) 10, 0.0 100, 0.0 1000, 0.0 10000, 0.0 100000, 0.4 1000000, 3.5 10000000, 40.2 100000000, 369.49997 

in c version get:

100000000, 296.693634, 295.762695, 340.574860 

it seems c version calculates same in 3 different ways , reports time took. using time wouldn't justice.


Comments

Popular posts from this blog

java - SSE Emitter : Manage timeouts and complete() -

jquery - uncaught exception: DataTables Editor - remote hosting of code not allowed -

java - How to resolve error - package com.squareup.okhttp3 doesn't exist? -