Re: Stdio.Buffer, need a way to revisit old positions in the output
"Per Hedbor () @ Pike (-) importm?te f?r mailinglistan" <[email protected]>
| Newsgroups | gmane.comp.lang.pike.user |
|---|---|
| Message-ID | <[email protected]> |
> Yes, that would give one a full-blown-protect-you-from-havoc solution > even if you don't know what you're doing with the buffer. > I still think that that would be more overhead than desirable > in high-efficiency buffer operations. The main issue is that you are likely to get core dumps if the pointer is invalid. Also, there is no way to _really_ know from the pike level when the buffer is going to output data to the file descriptor in the basic set_buffered mode, which would make the feature somewhat problematic to use in that case, unless the pointers are objects. Anyway, creating and destroying 1M rewindkey objects takes 0.2 seconds, when compared to calling a function in the buffer 1M times (sizeof, no arguments, via function pointer), which takes 0.04 seconds. Since you would need to call three functions to do the same thing as the subbuffer call (get offset, get added size, update at first offset) the time offsets are 0.12 vs 0.20 s per 1M calls on my machine. -- Per Hedbor