New operator overloading syntax. Was: Does std.bigint compile

bearophile bearophileHUGS at lycos.com
Fri Feb 26 15:39:04 PST 2010


Paul D. Anderson:
> This was also helpful to me, when I finally found it: http://www.prowiki.org/wiki4d/wiki.cgi?LanguageDevel/DIPs/DIP7

That page contains this point:

>Use case # 2: BigInt?, BigFloat?, etc: Time is dominated by two things: non-linear operations (*, /, etc), and memory allocation. Expression optimisation is unimportant, except for efficient handling of temporaries.<

It misses an important use case of bigints: safe integer values that most times are about as small as normal ints/longs, but can become two or more times longer in uncommon situations, for example an unusually large input.
This use case asks bigints to be very fast when they can fit in just 30-64 bits (so such number can be put inside the struct that represents the bigint, fully on the stack). In this case expression optimization becomes a little more important. (Python2.x uses such numbers, it shows you can write a large number of programs using just them, if they have that stack optimization for small values).

Bye,
bearophile



More information about the Digitalmars-d mailing list