[mercury-users] string__first_char

Michael Day mcda at students.cs.mu.oz.au
Mon Oct 16 11:51:57 AEDT 2000


> In fact even for the current implementation I think it is just
> a property that the implementation tries hard to ensure occurs;
> AFAIK there is no code in the current implementation which actually
> requires that property.

If it is not required, could the implementation perhaps try less hard to
ensure it occurs? Define it out until/unless the property actually becomes
necessary?

> We generally run the Boehm et al conservative garbage collector in a
> mode in which it only follows pointers to bytes within the first word
> of an object; pointers into the middle of an object are ignored by the
> GC.  So although the GC doesn't require strings to be word aligned, it
> doesn't allow arbitrary pointers into the middle of strings, and so 

and so...?

> That depends on how you code it.  If you process strings using
> string__first_char, then yes, things will probably be inefficient.
> But if you make use of string__foldl and enable intermodule optimization,
> you should get C-like performance.

Well, first_char is useful when processing strings in a streamy kind of
way; in particular I've written a bunch of regular expression code which
uses first_char all over the place, where foldl is not really appropriate.

Michael

--------------------------------------------------------------------------
mercury-users mailing list
post:  mercury-users at cs.mu.oz.au
administrative address: owner-mercury-users at cs.mu.oz.au
unsubscribe: Address: mercury-users-request at cs.mu.oz.au Message: unsubscribe
subscribe:   Address: mercury-users-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------



More information about the users mailing list