[OT] Why mobile web apps are slow

Paulo Pinto pjmlp at progtools.org
Tue Jul 16 09:07:41 PDT 2013


Am 16.07.2013 16:53, schrieb Jonathan Dunlap:
>>> So before Java was born, I was already convinced a GC was
> possible for systems programming.
>
> Can you explain (simply) how D's GC works and what improvements are on
> the roadmap for it? As it sits, I'm a little hesitant to use it for
> large applications because of its overhead I've heard about on other
> threads.
>
> http://3d.benjamin-thaut.de/?p=20
> "the manual memory managed version runs at 5 ms which is 200 FPS and
> thus nearly 3 times as fast as the GC collected version."

I am just a D follower, so Benjamin and other guys are better indicated 
to speak about it.

Having said this, currently D's GC is a stop the world collector with a 
basic implementation, when compared with Java and .NET offerings.

Last year some improvements were made, specially associating some type 
information via the generation of TypeInfo instances.

http://dlang.org/phobos/object.html#.TypeInfo

At D2013 there were some presentations about how to improve the GC.

A Precise Garbage Collector for D
http://www.youtube.com/watch?v=LQY1m_eT37c

Concurrent Garbage Collection for D
http://www.youtube.com/watch?v=1MF5bcmvJ0o

Now, it all depends on the type of application you are planning to use 
it. In many cases, even with the current GC implementation, it is 
possible to achieve good performance if you code in a GC friendly way.

You can also make use of library types for reference counting,

http://dlang.org/phobos/std_typecons.html#.RefCounted

And if you really, really need, also manual memory management by calling 
the C functions and letting the GC know not to track that memory.

http://dlang.org/phobos/core_memory.html#.GC.BlkAttr.NO_SCAN

There are some discussions going on about adding reference counting at 
the compiler level, similar to Rust/ParaSail. Additionally, you can 
count that the GC will eventually be improved, just that these things 
take time.

--
Paulo


More information about the Digitalmars-d mailing list