bug-guile
[Top][All Lists]
Advanced

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

bug#12033: closed (Re: bug#12033: format should be faster)


From: Noah Lavine
Subject: bug#12033: closed (Re: bug#12033: format should be faster)
Date: Mon, 20 Aug 2012 23:00:24 -0400

Hello,

> --------------------code-------------------
> scheme@(guile-user)> ,profile (let lp ((i 10000)) (if (> i 0) (begin
> (format #f "0x~2'0x, 0x~2'0x, 0x~2'0x" i i i) (lp (1- i)))))
> %     cumulative   self
> time   seconds     seconds      name
> 22.58      0.56      0.23  tilde-dispatch
> 12.90      1.00      0.13  format
> 12.90      0.13      0.13  number->string
>   8.06      0.13      0.08  format:out-char
>   4.84      0.80      0.05  format:format-work
> --------------------end-------------------
>
> In this case, we tried "0x~2'0x" and it's so slow that we can't bare it.
> i=10000 is fast, but we need (* 600 80000)
> And we found that "tilde-dispatch" cost too much. Is there any possible
> to optimize it?

It seems clear that in this case, Guile "should" know how to dispatch
on the format string just once, outside of the loop, instead of doing
it in every iteration. What do people think of declaring format as a
macro? That wouldn't help instances of format that have a variable
format string, but I bet that's a lot less common than this case.

Noah





reply via email to

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