efficient input range buffering
Martin Nowak
dawg at dawgfoto.de
Sun Oct 2 07:12:12 PDT 2011
I've written a wrapper to promote input ranges to buffered forward ranges.
It allows to write range agnostic lexers/parsers with infinite lookahead.
Buffering is done through a singly linked list of memory blocks that are
reference counted.
Each saved range holds a reference to all future blocks.
Blocks are recycled when being no longer used.
https://gist.github.com/1257196
There is a major issue with the somewhat broken implicit-save-through-copy
concept.
A lot of copies in function parameters, foreach loops etc. will also create
references and thus can be easily responsible for inefficiencies.
martin
More information about the Digitalmars-d
mailing list