From: Alain Frisch <alain@frisch.fr>
To: caml-list <caml-list@inria.fr>
Subject: [Caml-list] Understanding Format
Date: Mon, 23 Jul 2012 11:05:46 +0200 [thread overview]
Message-ID: <500D13EA.8010002@frisch.fr> (raw)
Hi all,
I'm trying to understand the semantics of Format boxes, and I need some
help! Consider the following:
let () =
set_margin 500;
open_vbox 0;
for _i = 1 to 300 do
open_hbox ();
print_string "x";
close_box ()
done;
close_box ()
Format inserts line breaks, even though the page width (margin) should
be large enough to contain 300 characters (and there is no break hint
anyway). Why does it do it? Changing the value passed to set_margin
does not seem to make a difference (except for small values < 70).
I'm also interest in understanding the performance of Format. In the
example above, changing 300 to 1000000, the program takes about 0.6s to
execute on my machine. This does not seem to be impacted by the value
passed to set_margin... except for large values (like max_int), where
the program takes about 1s. Is this slowdown for "unbounded" width
expected? (Interestingly, despite this slowdown, the unbounded-width
version allocates less than the bounded-width case.)
Alain
next reply other threads:[~2012-07-23 9:05 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-07-23 9:05 Alain Frisch [this message]
2012-07-24 13:16 ` Olivier Andrieu
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=500D13EA.8010002@frisch.fr \
--to=alain@frisch.fr \
--cc=caml-list@inria.fr \
/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