Things that keep D from evolving?

Ola Fosheim Grøstad via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sun Feb 7 01:09:54 PST 2016


On Sunday, 7 February 2016 at 02:46:39 UTC, Marco Leise wrote:
> My code would not see much ref counting in performance critical
> loops. There is no point in ref counting every single point in
> a complex 3D scene.
> I could imagine it used on bigger items. Textures for example
> since they may be used by several objects. Or - a prime
> example - any outside resource that is potentially scarce and
> benefits from deterministic release: file handles, audio
> buffers, widgets, ...

In my experience most such resources don't need reference 
counting. Yes, Textures if you load dynamically, but if you load 
Textures before entering the render loop... not so much and it 
should really be a caching system so you don't have to reload the 
texture right after freeing it. File handles are better done as 
single borrow from owner, or pass by reference, you don't want 
multiple locations to write to the same file handle, audio 
buffers should be preallocated as they cannot be deallocated 
cheaply on the real time thread, widgets benefit more from 
weak-pointers/back-pointers-to-borrowers as they tend to have a 
single owning parent...

What would be better is to build better generic static analysis 
and optimization into the compiler. So that the compiler can 
deduce that an integer is never read except when decremented, and 
therefore can elide inc/dec pairs.



More information about the Digitalmars-d-learn mailing list