Skip to content

Instantly share code, notes, and snippets.

@mmurooka
Last active June 19, 2019 12:23
Show Gist options
  • Save mmurooka/63165b0e93941547c3bf075d5fa97c9a to your computer and use it in GitHub Desktop.
Save mmurooka/63165b0e93941547c3bf075d5fa97c9a to your computer and use it in GitHub Desktop.
Compare computation time between aux and let
(defun test1
(&aux a b c)
a
)
(defun test2
()
(let (a b c)
a
))
(defun test3
()
(let* (a b c)
a
))
(print "use aux")
(bench (dotimes (i 5000000) (test1)))
(print "use let")
(bench (dotimes (i 5000000) (test2)))
(print "use let*")
(bench (dotimes (i 5000000) (test3)))
$ roseus hoge.l
configuring by "/opt/ros/melodic/share/euslisp/jskeus/eus//lib/eusrt.l"
;; readmacro ;; object ;; packsym ;; common ;; constants ;; stream ;; string ;; loader ;; pprint ;; process ;; hashtab ;; array ;; mathtran ;; eusdebug ;; eusforeign ;; coordinates ;; tty ;; history ;; toplevel ;; trans ;; comp ;; builtins ;; par ;; intersection ;; geoclasses ;; geopack ;; geobody ;; primt ;; compose ;; polygon ;; viewing ;; viewport ;; viewsurface ;; hid ;; shadow ;; bodyrel ;; dda ;; helpsub ;; eushelp ;; xforeign ;; Xdecl ;; Xgraphics ;; Xcolor ;; Xeus ;; Xevent ;; Xpanel ;; Xitem ;; Xtext ;; Xmenu ;; Xscroll ;; Xcanvas ;; Xtop ;; Xapplwin
connected to Xserver DISPLAY=:0
X events are being asynchronously monitored.
;; pixword ;; RGBHLS ;; convolve ;; piximage ;; pbmfile ;; image_correlation ;; oglforeign ;; gldecl ;; glconst ;; glforeign ;; gluconst ;; gluforeign ;; glxconst ;; glxforeign ;; eglforeign ;; eglfunc ;; glutil ;; gltexture ;; glprim ;; gleus ;; glview ;; toiv-undefined ;; fstringdouble irtmath irtutil irtc irtgeoc irtgraph ___time ___pgsql irtgeo euspqp pqp irtscene irtmodel irtdyna irtrobot irtsensor irtbvh irtcollada irtpointcloud irtx eusjpeg euspng png irtimage irtglrgb
;; extending gcstack 0x55ff1ed1b690[16374] --> 0x55ff1f1a0b70[32748] top=3d61
irtgl irtglc irtviewer
EusLisp 9.26( 1.2.1) for Linux64 created on ip-172-30-1-203(Fri May 31 16:58:14 PST 2019)
roseus ;; loading roseus("1.7.4") on euslisp((9.26 ip-172-30-1-203 Fri May 31 16:58:14 PST 2019 1.2.1))
eustf roseus_c_util
"use aux"
;; time -> 0.738809[s]
"use let"
;; time -> 0.889221[s]
"use let*"
;; time -> 0.842709[s]
@mmurooka
Copy link
Author

What does sequential let is faster than the sequential one mean?

@Affonso-Gui
Copy link

Sorry, fixed that typo on the above comment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment