efficient input range buffering
bearophile
bearophileHUGS at lycos.com
Sun Oct 2 10:27:53 PDT 2011
Martin Nowak:
> https://gist.github.com/1257196
To avoid the GC to waste time following the linked list, isn't it better to use a dynamic array of pointers (or a dynamic array of arrays) (so it becomes a flat data structure)?
And:
version (unittest)
{
import std.stdio, std.algorithm;
}
unittest
{
static struct InputRange
{
this(size_t *pn)
{
_pn = pn;
}
bool empty() const { return *_pn == 1_000_000; }
I suggest ==>
unittest
{
import std.stdio, std.algorithm;
static struct InputRange
{
bool empty() const { return *_pn == 1_000_000; }
Bye,
bearophile
More information about the Digitalmars-d
mailing list