Re: [PATCH] Implement efficient 'scm_unget_bytes' and 'unget-bytevector'

2013-04-07 Thread Ludovic Courtès
Mark H Weaver skribis: > l...@gnu.org (Ludovic Courtès) writes: > >> A faster possibility (aka. let’s release!) would be to add something >> like that at the end of “Binary Input”: >> >> The (ice-9 binary-ports) module provides the following procedure as an >> extension to (rnrs io ports): >

Re: [PATCH] Implement efficient 'scm_unget_bytes' and 'unget-bytevector'

2013-04-07 Thread Mark H Weaver
Hi Ludovic! l...@gnu.org (Ludovic Courtès) writes: > A faster possibility (aka. let’s release!) would be to add something > like that at the end of “Binary Input”: > > The (ice-9 binary-ports) module provides the following procedure as an > extension to (rnrs io ports): I like this idea, and

Re: [PATCH] Implement efficient 'scm_unget_bytes' and 'unget-bytevector'

2013-04-07 Thread Ludovic Courtès
Mark H Weaver skribis: > l...@gnu.org (Ludovic Courtès) writes: > >> Mark H Weaver skribis: [...] >>> I've used it to unget 15 megabytes, and it was quite fast. >>> Unfortunately, I'm at a bit of a loss of where to document it in the >>> manual. >> >> What about adding a sentence to mention (i

Re: [PATCH] Implement efficient 'scm_unget_bytes' and 'unget-bytevector'

2013-04-07 Thread Mark H Weaver
Hi Ludovic, l...@gnu.org (Ludovic Courtès) writes: > Mark H Weaver skribis: > >> Here's an improved patch that also exports 'unget-bytevector' from >> (ice-9 binary-ports). > > LGTM. Excellent :) >> I've used it to unget 15 megabytes, and it was quite fast. >> Unfortunately, I'm at a bit of a

Re: [PATCH] Implement efficient 'scm_unget_bytes' and 'unget-bytevector'

2013-04-06 Thread Ludovic Courtès
Mark H Weaver skribis: > Mark H Weaver writes: > >> I discovered that 'scm_unget_byte' is kind of dumb. It puts the bytes >> at the beginning of the pushback buffer instead of the end. This means >> that every time you unget a byte, it has to shift up the existing >> contents of the buffer, so

Re: [PATCH] Implement efficient 'scm_unget_bytes' and 'unget-bytevector'

2013-04-06 Thread Mark H Weaver
Mike Gran writes: > It is true that none of Guile's clients ever look at putback_buf? I'm assuming the worst: that Guile's clients might look at, and manipulate the 'putback_buf' directly. The way I'm filling 'putback_buf' can *already* happen today. Here's how it can happen today: unget enoug

Re: [PATCH] Implement efficient 'scm_unget_bytes' and 'unget-bytevector'

2013-04-06 Thread Mike Gran
>> I discovered that 'scm_unget_byte' is kind of dumb.  It puts the > bytes >> at the beginning of the pushback buffer instead of the end.  This means >> that every time you unget a byte, it has to shift up the existing >> contents of the buffer, so ungetting N bytes takes O(N^2) time. >> >>

[PATCH] Implement efficient 'scm_unget_bytes' and 'unget-bytevector'

2013-04-06 Thread Mark H Weaver
it in the manual. Comments and suggestions solicited. Mark >From 00c36fdd2e4d94a37fa416e3bc8436f66bba612a Mon Sep 17 00:00:00 2001 From: Mark H Weaver Date: Sat, 6 Apr 2013 01:42:45 -0400 Subject: [PATCH] Implement efficient 'scm_unget_bytes' and 'unget-bytevector'.