GNU bug report logs -
#17147
Performance regression by 3000000% for evaluating "and" form
Previous Next
Reported by: David Kastrup <dak <at> gnu.org>
Date: Mon, 31 Mar 2014 09:59:02 UTC
Severity: wishlist
Done: Mark H Weaver <mhw <at> netris.org>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
[Message part 1 (text/plain, inline)]
The following code continues exploding in Guile 2.0.9 even after fixing
the VM exploding under the stock "reduce-right" and after chickening out
on syntax-case et al for "and" and using a procedural macro instead.
[zorpo.scm (text/plain, inline)]
(use-modules (srfi srfi-1))
(define (reduce-right f ridentity lst)
"`reduce-right' is a variant of `fold-right', where the first call to
F is on two elements from LST, rather than one element and a given
initial value. If LST is empty, RIDENTITY is returned. If LST
has just one element then that's the return value."
(reduce f ridentity (reverse lst)))
(define-macro (and . rest)
(reduce-right
(lambda (a b) `(if ,a ,b #f))
#t
rest))
(primitive-eval (cons 'and (make-list 10000 #f)))
[Message part 3 (text/plain, inline)]
Now I get
Backtrace:
In ice-9/psyntax.scm:
1259: 19 [#<procedure 8f2da28 (test then else)> #f (if #f (if #f # #f) #f) #f]
1259: 18 [#<procedure 8f2da00 (test then else)> #f (if #f (if #f # #f) #f) #f]
1259: 17 [#<procedure 8f2d9d8 (test then else)> #f (if #f (if #f # #f) #f) #f]
1259: 16 [#<procedure 8f2d9b0 (test then else)> #f (if #f (if #f # #f) #f) #f]
1259: 15 [#<procedure 8f2d988 (test then else)> #f (if #f (if #f # #f) #f) #f]
1259: 14 [#<procedure 8f2d960 (test then else)> #f (if #f (if #f # #f) #f) #f]
1259: 13 [#<procedure 8f2d938 (test then else)> #f (if #f (if #f # #f) #f) #f]
1259: 12 [#<procedure 8f2d910 (test then else)> #f (if #f (if #f # #f) #f) #f]
1259: 11 [#<procedure 8f2d8e8 (test then else)> #f (if #f (if #f # #f) #f) #f]
1259: 10 [#<procedure 8f2d8c0 (test then else)> #f (if #f (if #f # #f) #f) #f]
1259: 9 [#<procedure 8f2d898 (test then else)> #f (if #f (if #f # #f) #f) #f]
1259: 8 [#<procedure 8f2d870 (test then else)> #f (if #f (if #f # #f) #f) #f]
1257: 7 [#<procedure 8f2d848 (test then else)> #f (if #f (if #f # #f) #f) #f]
1186: 6 [syntax-type (if #f (if #f (if #f # ...) ...) ...) () ...]
579: 5 [syntax-type if () ((top)) #f #f (hygiene guile-user) #t]
293: 4 [get-global-definition-hook if (hygiene guile-user)]
In ice-9/boot-9.scm:
2697: 3 [#<procedure 8c38450 at ice-9/boot-9.scm:2696:4 (name #:optional autoload version #:key ensure)> # ...]
2512: 2 [nested-ref-module #<module () 8c25ca8> (guile-user)]
2294: 1 [module-ref-submodule #<module () 8c25ca8> guile-user]
1925: 0 [#<procedure 8c31240 at ice-9/boot-9.scm:1925:2 (module)> #]
ice-9/boot-9.scm:1925:2: In procedure #<procedure 8c31240 at ice-9/boot-9.scm:1925:2 (module)>:
ice-9/boot-9.scm:1925:2: Throw to key `vm-error' with args `(vm-run "VM: Stack overflow" ())'.
Using guile --no-auto-compile on the same file, I just get
Backtrace:
In ice-9/psyntax.scm:
1259: 19 Aborted (core dumped)
That's the stable version of GUILE included with Ubuntu 14.04.
--
David Kastrup
This bug report was last modified 11 years and 41 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.