Author Topic: Houston, ... i have a problem  (Read 2010 times)

0 Members and 1 Guest are viewing this topic.

RobbeK

  • Guest
Houston, ... i have a problem
« on: February 21, 2015, 02:33:54 PM »
It's about the GNU Common Lisp compiler ...

runs greased lightning speed on Linux , slow on Win

.........................................;    LINUX
>(defun tst ()
   (let ((a 0) (b 0))
    (dotimes (i 10000000 (list a b))
      (if (evenp i) (incf a) (incf b)))))

TST

>(compile 'tst)

Compiling /tmp/gazonk_5582_0.lsp.
End of Pass 1. 
End of Pass 2. 
OPTIMIZE levels: Safety=0 (No runtime error checking), Space=0, Speed=3
Finished compiling /tmp/gazonk_5582_0.lsp.
Loading /tmp/gazonk_5582_0.o
start address -T 0x8a36b8 Finished loading /tmp/gazonk_5582_0.o
#<compiled-function TST>
NIL
NIL

>(time (tst))

real time       :      0.059 secs
run-gbc time    :      0.039 secs
child run time  :      0.000 secs
gbc time        :      0.000 secs
(5000000 5000000)
...........................................................................

installed the Win distribution on another (somewhat slower, but not too much) computer and here it takes about 20 times longer .. 

Now
1) the Lisp source should be compiled with the GCC , under Win GCL comes with a (tiny) MinGW compiler suite
2) documentation is esoteric and vague & only ECL mentions (same Austin Kyoto LISP family) the generated code under *NIX is native , while bytecode under Win.
3) set up the latest GCC under windows and directed the PATH to this location --  however ,  while sourgeforce mentions both "for 32 and 64 bit" , the REPL upon compilation gives , not a win32 appl.

Some one knows more ??  any cure ??

thanks in advance, Rob



jack

  • Guest
Re: Houston, ... i have a problem
« Reply #1 on: February 21, 2015, 04:37:47 PM »
yes, gcl on windows is not performing as expected but sbcl is pretty quick
Quote
GCL (GNU Common Lisp)  2.6.6 CLtL1    Feb 10 2005 08:19:54
Source License: LGPL(gcl,gmp), GPL(unexec,bfd)
Binary License:  GPL due to GPL'ed components: (UNEXEC)
Modifications of this banner must retain notice of a compatible license
Dedicated to the memory of W. Schelter

Use (help) to get some basic information on how to use GCL.

>(defun tst()
(let ((a 0) (b 0))
(dotimes (i 10000000 (list a b))
(if (evenp i) (incf a) (incf b)))))

TST

>>(compile 'tst)

Compiling gazonk0.lsp.
End of Pass 1.
End of Pass 2.
OPTIMIZE levels: Safety=0 (No runtime error checking), Space=0, Speed=3
Finished compiling gazonk0.lsp.
Loading gazonk0.o
start address -T 101299b8 Finished loading gazonk0.o
#<compiled-function TST>
>>(time (tst))

real time       :      0.490 secs
run-gbc time    :      0.460 secs
child run time  :      0.000 secs
gbc time        :      0.030 secs
(5000000 5000000)
>>

This is SBCL 1.2.7, an implementation of ANSI Common Lisp.
More information about SBCL is available at <http://www.sbcl.org/>.

SBCL is free software, provided as is, with absolutely no warranty.
It is mostly in the public domain; some portions are provided under
BSD-style licenses.  See the CREDITS and COPYING files in the
distribution for more information.

WARNING: the Windows port is fragile, particularly for multithreaded
code.  Unfortunately, the development team currently lacks the time
and resources this platform demands.
* (defun tst()
(let ((a 0) (b 0))
(dotimes (i 10000000 (list a b))
(if (evenp i) (incf a) (incf b)))))

TST
* (compile 'tst)

TST
NIL
NIL
* (time (tst))

Evaluation took:
  0.031 seconds of real time
  0.031200 seconds of total run time (0.031200 user, 0.000000 system)
  100.00% CPU
  104,634,240 processor cycles
  0 bytes consed

(5000000 5000000)

RobbeK

  • Guest
Re: Houston, ... i have a problem
« Reply #2 on: February 22, 2015, 01:18:21 AM »
Thanks Jack,

I'll better use SBCL then ,  the problem with GCL is probably the same as mentioned in the ECL documentation :

"
In Windows ECL comes with bytecodes compiler by default, because C
  compilers are normally not avaiable. Unfortunately several
  libraries out there are not prepared for this. "

best, Rob