Why is D slower than LuaJIT?
spir
denis.spir at gmail.com
Thu Dec 23 05:22:55 PST 2010
On Wed, 22 Dec 2010 23:22:56 -0600
Andrei Alexandrescu <SeeWebsiteForEmail at erdani.org> wrote:
> I'm thinking what to do about iota, which has good features but exacts
> too much cost on tight loop performance. One solution would be to define
> iota to be the simple, forward range that I defined as Iota2 in my
> previous post. Then, we need a different name for the full-fledged iota
> (random-access, has known length, iterates through the same numbers
> forward and backward etc). Ideas?
I would keep length and add an opIn: if (e in interval) {...}. (I'm unsure whether it's worth allowing different types for bounds and/or for step; I'd rather make things simple.) Then, you could call it Interval, what do you think?
Note: The result would be very similar to python (x)ranges. D has a notation for a slightly narrower notion: '..'. Thus, what about:
Interval!int interval = 1..9;
or else:
auto interval = Interval!int(1..9);
?
What kind of thingie does "i..j" actually construct as of now?
Denis
-- -- -- -- -- -- --
vit esse estrany ☣
spir.wikidot.com
More information about the Digitalmars-d
mailing list