compiling lots of distinct calls to local function is slow

Bug #1379661 reported by 3b
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
SBCL
New
Undecided
Unassigned

Bug Description

(time
 (compile nil
  `(lambda ()
     (flet ((c (a b)
              (list a b)))
       ,@(loop for i below 512 collect `(print (c ,(random 10000) ,(random 1000))))))))

 Evaluation took:
  16.357 seconds of real time
  16.332863 seconds of total run time (16.213013 user, 0.119850 system)
  [ Run times consist of 0.049 seconds GC time, and 16.284 seconds non-GC time. ]
  99.85% CPU
  2 lambdas converted
  43,585,318,794 processor cycles
  4,592,853,744 bytes consed

similar times in 1.0.32.10 and "1.2.3.57-d88324a"

with fewer argument combinations, or with a global function, it compiles quickly:

(time
 (compile nil
  `(lambda ()
     (flet ((c (a b)
              (list a b)))
       ,@(loop for i below 512 collect `(print (c ,(random 2) ,(random 2))))))))
Evaluation took:
  0.088 seconds of real time
  0.088170 seconds of total run time (0.088170 user, 0.000000 system)
  100.00% CPU
  2 lambdas converted
  235,351,339 processor cycles
  23,577,632 bytes consed

(defun c2 (a b) (list a b))
(time
 (compile nil
  `(lambda ()
     (flet ((c (a b)
              (list a b)))
       ,@(loop for i below 512 collect `(print (c2 ,(random 2) ,(random 2))))))))
Evaluation took:
  0.028 seconds of real time
  0.027355 seconds of total run time (0.027355 user, 0.000000 system)
  96.43% CPU
  2 lambdas converted
  73,137,274 processor cycles
  6,634,448 bytes consed

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.