[OT] Why mobile web apps are slow
Adam D. Ruppe
destructionator at gmail.com
Tue Jul 9 16:01:01 PDT 2013
On Tuesday, 9 July 2013 at 22:40:31 UTC, bearophile wrote:
> - A less allocating Phobos to produce a bit less garbage;
Yes, and options to pass output ranges to more functions too,
instead of always returning gc allocated things.
> - Perhaps an annotation to disallow heap allocations in a
> function or a piece of code;
I don't think that will often get used, especially when we're
already doing @safe pure const static void foo(); as it is.
> - Some good way to allocate variable length arrays on the stack
> (http://d.puremagic.com/issues/show_bug.cgi?id=9832 ) (so some
> arrays produce no garbage);
These might be cool. Something we can do today is use static
arrays as buffers. In my non-gc D experiments, I've made great
use of a StackArray!(type, max_capacity) with the convenience
operators overloaded. Combined with a solid "scope"
implementation, this could be fast, convenient, and safe.
Of course it would need to have a statically known max length big
enough to store what you want to store without being too
wasteful. But I don't think that's particularly hard in most
cases - at least we have RangeError so it dies gracefully instead
of buffer overflowing like you'd get i C. (It could also
automatically grow to the gc heap if the programmer is ok with
that.)
> - The implementation of "scope" maybe helps a bit;
Yes.
> Is that enough? Rust language designers seem to think that's
> not enough. Opinions are welcome.
I think if we do scope well enough, we'll have something similar
to Rust that we can flesh out more in the library.
More information about the Digitalmars-d
mailing list