GNU bug report logs -
#12033
format should be faster
Previous Next
Reported by: nalaginrut <nalaginrut <at> gmail.com>
Date: Mon, 23 Jul 2012 13:55:02 UTC
Severity: normal
Done: ludo <at> gnu.org (Ludovic Courtès)
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
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
This bug report was last modified 12 years and 357 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.