Thread overview
[Issue 8500] New: DList extremely wasteful in node allocation
Aug 02, 2012
Jonathan M Davis
August 02, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8500

           Summary: DList extremely wasteful in node allocation
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: major
          Priority: P2
         Component: Phobos
        AssignedTo: nobody@puremagic.com
        ReportedBy: alex@lycus.org


--- Comment #0 from Alex Rønne Petersen <alex@lycus.org> 2012-08-02 23:18:38 CEST ---
The DList container currently allocates a Node struct with the GC instead of managing their memory manually. I don't know if there's anything preventing manual memory management here, but the current approach is extremely wasteful.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
August 02, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8500


Jonathan M Davis <jmdavisProg@gmx.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jmdavisProg@gmx.com


--- Comment #1 from Jonathan M Davis <jmdavisProg@gmx.com> 2012-08-02 15:38:29 PDT ---
I wouldn't expect it to do anything else until custom allocators are implemented. Then the allocator used will determine the allocation scheme used.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
August 02, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8500


Andrei Alexandrescu <andrei@metalanguage.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |andrei@metalanguage.com
           Severity|major                       |enhancement


--- Comment #2 from Andrei Alexandrescu <andrei@metalanguage.com> 2012-08-02 15:45:27 PDT ---
This is following the traditional approach of Java and other languages. Allocators will take care of this.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
August 03, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8500



--- Comment #3 from Alex Rønne Petersen <alex@lycus.org> 2012-08-03 02:57:31 CEST ---
> I wouldn't expect it to do anything else until custom allocators are implemented. Then the allocator used will determine the allocation scheme used.

I'd honestly expected it to use malloc/free like Array(T).

> This is following the traditional approach of Java and other languages.
Allocators will take care of this.

Right, I'm just saying that the inefficiency of insertions (which is one of the most common operations next to removal) in DList almost negates any performance gained by using it instead of a plain Array(T) for some use cases (for me, instruction streams in a JIT compiler). For large workloads, it'll induce a lot of GC cycles, scanning, and freeing, which is way worse for throughput than the slightly less efficient insertion and removal algorithms on an Array(T) which at least use malloc/free.

I know allocators will solve this, but I think that a malloc/free approach in the meantime would be reasonable enough (if doable).

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------