[parenscript-devel] long compile time
Vladimir Sedach
vsedach at gmail.com
Tue Jul 7 04:28:30 UTC 2009
Thanks for posting your results! This is really curious:
(time (eval
'(defun somefunction ()
(ps (form)))))
672.596 seconds of real time
I'm not sure what's going on here. The two versions of 'ps'
essentially do the same macroexpansion. As a matter of fact, the new
one conses slightly more.
My little test (form was a function call with 5000 dummy arguments)
did not exhibit such a long eval time for the defun. I think what may
be happening is that 'concatenate' in SBCL now (sometime between
1.0.22, which I'm running, and 1.0.29) has a compiler macro that
attempts to do constant string concatenation at compile-time. That's
just a guess though.
; ps with write-to-string
(time (eval
'(defun somefunction ()
(ps (form)))))
Evaluation took:
32.524 seconds of real time
That's a lot of time. How many tokens does your code have?
What I need to do is figure out the best way available across most
implementations to spit out strings (which just might be
'write-to-string') and to push that down to the Parenscript printer,
instead of having it return a list of strings. That should close the
gap between 'ps' and 'ps*' and provide a big improvement in speed, and
if streams are involved, let you direct the output of Parenscript
directly into one.
Vladimir
On Mon, Jul 6, 2009 at 8:50 PM, <Kelly.P.McDonald at gmail.com> wrote:
> Vladimir,
>
> sorry about the truncated post earlier.
>
> I'm using sbcl 1.0.29
>
> here are my results:
>
> (time (eval
> '(defun somefunction ()
> (ps* '(form)))))
>
> Evaluation took:
> 0.007 seconds of real time
> 0.004000 seconds of total run time (0.004000 user, 0.000000 system)
> 57.14% CPU
> 9 forms interpreted
> 3 lambdas converted
> 7,264,237 processor cycles
> 625,872 bytes consed
>
>
> (time (somefunction))
>
> Evaluation took:
> 0.555 seconds of real time
> 0.456028 seconds of total run time (0.412025 user, 0.044003 system)
> [ Run times consist of 0.300 seconds GC time, and 0.157 seconds non-GC time.
> ]
> 82.16% CPU
> 85 lambdas converted
> 555,544,368 processor cycles
> 6,404,784 bytes consed
>
>
> ; ps with concatenate
> (time (eval
> '(defun somefunction ()
> (ps (form)))))
>
> Evaluation took:
> 672.596 seconds of real time
> 517.380334 seconds of total run time (501.967371 user, 15.412963 system)
> [ Run times consist of 7.004 seconds GC time, and 510.377 seconds non-GC
> time. ]
> 76.92% CPU
> 9 forms interpreted
> 3 lambdas converted
> 3,125,982,714,733 processor cycles
> 5 page faults
> 560,010,640 bytes consed
>
> (time (somefunction))
>
> Evaluation took:
> 0.651 seconds of real time
> 0.548034 seconds of total run time (0.544034 user, 0.004000 system)
> 84.18% CPU
> 657,341,464 processor cycles
> 826,672 bytes consed
>
>
> ; ps with write-to-string
> (time (eval
> '(defun somefunction ()
> (ps (form)))))
>
>
> Evaluation took:
> 32.524 seconds of real time
> 29.861866 seconds of total run time (29.461841 user, 0.400025 system)
> [ Run times consist of 1.129 seconds GC time, and 28.733 seconds non-GC
> time. ]
> 91.82% CPU
> 9 forms interpreted
> 91 lambdas converted
> 65,799,376,447 processor cycles
> 135,977,120 bytes consed
>
>
> (time (somefunction))
> Evaluation took:
> 0.004 seconds of real time
> 0.004000 seconds of total run time (0.004000 user, 0.000000 system)
> 100.00% CPU
> 3,869,482 processor cycles
> 200,144 bytes consed
>
>
> A huge improvement, and I understand what is going on much better. I had
> been using compile-script previously.
>
>
> Thanks,
> Kelly
More information about the parenscript-devel
mailing list