chicken-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Chicken-users] Significant overhead to simple-macros?


From: Raffael Cavallaro
Subject: Re: [Chicken-users] Significant overhead to simple-macros?
Date: Fri, 7 Oct 2005 09:18:53 -0400


On Oct 7, 2005, at 2:00 AM, felix winkelmann wrote:

The expansion of macros and module forms does influence possible
optimizations of the compiler. What optimization options have you used?
You can also try to compile the code with "-debug o"  with and without
simple macros.
Can you send me the code for fib-iter?

sure:
---------- fib-iter.scm -------------

(require-extension numbers)

(declare (c-options "-fast") (unsafe) (no-bound-checks) (disable- interrupts))

(define fib
(lambda (n)
   (if (= n 0) 0
       (do ((index 1 (+ index 1))
            (current 1 (+ current previous))
            (previous 0 current))
           ((= index n) current) ))))

-----------------------------------

BTW, I've just tried this with an interpreted version (without compiling an extension, just loading a copy of fib-iter.scm without the compiler declarations called fib-test.scm into csi) and I get the same factor of two slowdown with simple-macros loaded, so it seems it might not be related to compiler optimizations, since both the factor of 2 slowdown and the actual timings are exactly the same for interpreted code.

Here's the output for -debug o. BTW, fib-debug.scm is an identical copy of fib-iter.scm:

rafg5:/scheme raffaelc$ sudo chicken-setup -csc-option "-debug o" "fib-debug.scm" /usr/local/bin/csc -feature compiling-extension -debug o -O2 -no- trace -vs fib-debug.scm /usr/local/bin/chicken fib-debug.scm -output-file fib-debug.c - dynamic -feature chicken-compile-shared -quiet -feature compiling- extension -debug o -optimize-level 2 -no-trace
eliminated procedure checks: 0
replaced variables: 6
removed binding forms: 13
customizable procedures: (do45)
calls to known targets: 2 1
fast box initializations: 1
fast global references: 0
fast global assignments: 0
rm fib-debug.csc
gcc fib-debug.c -o fib-debug.o -DHAVE_CHICKEN_CONFIG_H -Os -fomit- frame-pointer -fno-strict-aliasing -Wall -Wno-unused -Wno- uninitialized -DHAVE_ALLOCA_H -no-cpp-precomp - DC_STACK_GROWS_DOWNWARD=1 "-DC_INSTALL_LIB_HOME=\"/usr/local/lib/ chicken\"" "-DC_INSTALL_HOME=\"/usr/local/share/chicken\"" - DC_USE_C_DEFAULTS -fPIC -DPIC -DC_SHARED -c -DC_NO_PIC_NO_DLL -fast
fib-debug.c: In function 'C_toplevel':
fib-debug.c:86: warning: dereferencing type-punned pointer will break strict-aliasing rules fib-debug.c:87: warning: dereferencing type-punned pointer will break strict-aliasing rules fib-debug.c:90: warning: dereferencing type-punned pointer will break strict-aliasing rules
fib-debug.c: In function 'f_20':
fib-debug.c:101: warning: dereferencing type-punned pointer will break strict-aliasing rules
fib-debug.c: In function 'f_23':
fib-debug.c:112: warning: dereferencing type-punned pointer will break strict-aliasing rules
fib-debug.c: In function 'f_26':
fib-debug.c:123: warning: dereferencing type-punned pointer will break strict-aliasing rules
fib-debug.c: In function 'f_29':
fib-debug.c:136: warning: dereferencing type-punned pointer will break strict-aliasing rules
fib-debug.c: In function 'f_31':
fib-debug.c:148: warning: dereferencing type-punned pointer will break strict-aliasing rules
fib-debug.c: In function 'f_38':
fib-debug.c:163: warning: dereferencing type-punned pointer will break strict-aliasing rules
fib-debug.c: In function 'f_43':
fib-debug.c:181: warning: dereferencing type-punned pointer will break strict-aliasing rules
fib-debug.c: In function 'f_50':
fib-debug.c:194: warning: dereferencing type-punned pointer will break strict-aliasing rules
fib-debug.c: In function 'f_57':
fib-debug.c:211: warning: dereferencing type-punned pointer will break strict-aliasing rules
rm fib-debug.c
gcc -o fib-debug.so fib-debug.o -lchicken -fPIC -bundle -L/usr/local/ lib -ldl -lm -ldl
rm fib-debug.o
  cp -r fib-debug.so /usr/local/lib/chicken
  rm fib-debug.so


regards


Raffael Cavallaro, Ph.D.
address@hidden





reply via email to

[Prev in Thread] Current Thread [Next in Thread]