http://d.puremagic.com/issues/show_bug.cgi?id=4298
Summary: Constant array translated to unnecessary array literal creation Product: D Version: 2.041 Platform: x86 OS/Version: All Status: NEW Keywords: performance Severity: normal Priority: P2 Component: DMD AssignedTo: nob...@puremagic.com ReportedBy: rsi...@gmail.com --- Comment #0 from Shin Fujishiro <rsi...@gmail.com> 2010-06-08 17:57:52 PDT --- Using constant (const or immutable) dynamic array causes unnecessary array literal creation if the constant array has an initializer. This behavior degrades performance, and also causes the bug 4297. Test code and the disassembled output: -------------------- immutable int[] TABLE = [ 1, 2, 3 ]; void foo() { const(int)[] tab = TABLE; } -------------------- _D4test3fooFZv: push EBP mov EBP,ESP push EBX push 3 push 2 push 1 push 3 mov EAX,offset FLAT:_d12typeinfo_axi6__in...@sym32 push EAX call _d_arrayliter...@pc32 mov ECX,EAX mov EBX,3 add ESP,014h pop EBX pop EBP ret -------------------- -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------