[m-rev.] for review: optimize calls to string.format and related predicates

Zoltan Somogyi zs at csse.unimelb.edu.au
Fri Sep 4 10:38:13 AEST 2009


On 03-Sep-2009, Julien Fischer <juliensf at csse.unimelb.edu.au> wrote:
>> This avoids memory allocation, but it requires more overheads in the I/O
>> system, e.g. retrievals of the current output stream. What do you think?
>
> The former seems preferable in the case where X, Y or both are (become)
> known, e.g. through the predicate being inlined, since that may lead to
> some of the string concatenations being optimised away.
>
> Although, it mightn't be if we had an optimisation that merged
> consecutive calls to io.write_string/{3,4}.  Something like:
>
>    io.write_string("Hello", !IO),
>    io.write_string(" World", !IO),
>
> into
>
>    io.write_string("Hello World", !IO)

Since it is clear that which approach is better depends on circumstances,
there is no point in implementing the other proposed approach until we make
progress on figuring out how to use the circumstances to make a good decision.
I am committing the existing diff with an additional comment in the code
summarizing this discussion.

Zoltan.
--------------------------------------------------------------------------
mercury-reviews mailing list
Post messages to:       mercury-reviews at csse.unimelb.edu.au
Administrative Queries: owner-mercury-reviews at csse.unimelb.edu.au
Subscriptions:          mercury-reviews-request at csse.unimelb.edu.au
--------------------------------------------------------------------------



More information about the reviews mailing list