guile-devel
[Top][All Lists]
Advanced

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

Re: Fast format (was Re: What can I do to help?)


From: Daniel Skarda
Subject: Re: Fast format (was Re: What can I do to help?)
Date: 06 Oct 2002 19:53:20 +0200
User-agent: Gnus/5.0808 (Gnus v5.8.8) Emacs/20.7

> > guile> (time (do-ntimes (n 100000) (simple-format p "~s" 3.14159265358979)))
> do-ntimes ?

  Common-Lisp like macro dotimes (see HyperSpec).

  The speed of simple-format is not problem. simple-format (C implementation) is
fast, the real problem is format from (ice-9 format). It is scheme format
implementation (it accepts more formating parameters than simple-format does.

guile> (time (do-ntimes (n 100000) (simple-format p "~s" 3.14159265358979)))
Elapsed time: 1.875558 sec

guile> (time (do-ntimes  (n 100000) (format p "~s" 3.14159265358979)))       
Elapsed time: 21.257521 sec

  Do you see the diference? For example, if you want to pad numbers, you have to
use scheme format implementation. 

  Think in C: if you want to just print numbers ("%d") you can use "fast
"implementation", if you want to write "%3d", you have to use more than 10 times
slower implementation. Strange, is not it?

0.




reply via email to

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