unofficial mirror of bug-guile@gnu.org 
 help / color / mirror / Atom feed
From: ludo@gnu.org (Ludovic Courtès)
To: 12033@debbugs.gnu.org
Cc: nalaginrut <nalaginrut@gmail.com>
Subject: bug#12033: closed (Re: bug#12033: format should be faster)
Date: Tue, 21 Aug 2012 00:37:35 +0200	[thread overview]
Message-ID: <87boi5gpg0.fsf@gnu.org> (raw)
In-Reply-To: <handler.12033.D12033.134549952018901.notifdone@debbugs.gnu.org> (GNU bug Tracking System's message of "Mon, 20 Aug 2012 21:52:02 +0000")

I wrote:

> Note that (ice-9 format) is an order of magnitude slower, though:
>
> scheme@(guile-user)> (f 4000)
> clock utime stime cutime cstime gctime
> 260.14 258.94  0.51   0.00   0.00  63.19
> $1 = #f
>
> Admittedly, this should be fixed, but that’s another story...

A bit of profiling shows this:

--8<---------------cut here---------------start------------->8---
scheme@(guile-user)> ,pr (with-output-to-port (%make-void-port "w") (lambda () (let loop ((i 40000)) (or (zero? i) (begin (format #t "~a ~a~%" 'foo 'bar) (loop (1- i)))))))
%     cumulative   self             
time   seconds     seconds      name
 15.70      2.13      0.34  format
 10.74      1.39      0.23  tilde-dispatch
 10.74      0.96      0.23  call-with-output-string
  7.44      0.20      0.16  #<procedure b042600 at ice-9/r4rs.scm:236:3 (p)>
[...]
Sample count: 121
Total time: 2.183744831 seconds (0.77482795 seconds in GC)
--8<---------------cut here---------------end--------------->8---

Procedure #4 is ‘with-output-to-string’, so we can easily improve that
by using ‘call-with-output-string’ directly instead:

--8<---------------cut here---------------start------------->8---
scheme@(guile-user)> ,pr (with-output-to-port (%make-void-port "w") (lambda () (let loop ((i 40000)) (or (zero? i) (begin (format #t "~a ~a~%" 'foo 'bar) (loop (1- i)))))))
%     cumulative   self             
time   seconds     seconds      name
 17.39      0.56      0.28  call-with-output-string
 14.13      0.24      0.23  #<procedure 11e5a1a0 at /home/ludo/src/guile/module/ice-9/format.scm:782:46 (p)>
 13.04      1.58      0.21  format
  9.78      1.27      0.16  format:format-work
[...]
Sample count: 92
Total time: 1.597127172 seconds (0.513423265 seconds in GC)
--8<---------------cut here---------------end--------------->8---

Commit 6c9220064d987deee813cfd933d50353d14d4c0f.

To be continued...

Ludo’.





  parent reply	other threads:[~2012-08-20 22:37 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-23  6:11 bug#12033: format should be faster nalaginrut
2012-08-18 22:19 ` Ludovic Courtès
2012-08-20  6:27   ` nalaginrut
2012-08-20 21:51     ` Ludovic Courtès
     [not found] ` <handler.12033.D12033.134549952018901.notifdone@debbugs.gnu.org>
2012-08-20 22:37   ` Ludovic Courtès [this message]
2012-08-21  2:50     ` bug#12033: closed (Re: bug#12033: format should be faster) nalaginrut
2012-08-21  3:00       ` Noah Lavine
2012-08-21  3:32         ` Ian Price
2012-08-21 11:37         ` Ludovic Courtès
2012-08-21 11:52           ` Noah Lavine
2012-08-21 13:40             ` Ludovic Courtès
2012-08-21 19:35           ` Andy Wingo
2012-08-23  3:23             ` nalaginrut
2012-08-23 21:55               ` Ludovic Courtès

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87boi5gpg0.fsf@gnu.org \
    --to=ludo@gnu.org \
    --cc=12033@debbugs.gnu.org \
    --cc=nalaginrut@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).