On Sat, Jun 27, 2020 at 05:16:34PM -0700, Alex Harsanyi wrote:
> Looking at the source for `read-xml`, it seems to be using `list->string` 
> in several places.  That is, it reads characters one-by-one and constructs 
> a list by appending a character to the end of it, than calls `list->string` 
> to produce the string.  I suspect read-xml could be made faster by using 
> `string-append` in these cases.

So you would be copying and reallocating strings instead of cons-cells?

The way to make that eliminate all that allocation is to implement a 
likely big enough mutable string buffer and insert characters (likely 
one at at time if I read you correctly) without allocating new storage 
each time (unless you've made the buffer too smal; in which case, double 
its size).

Then allocate the right amount of space for a string once and copy 
the buffer into it when the string has been completely read in.

-- hendrik

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/20200628190739.tpjrkilrf5eq546w%40topoi.pooq.com.

Reply via email to