Bug 14805 – [REG2.064] Unreasonably slow "new Struct[large]"

Status
RESOLVED
Resolution
FIXED
Severity
regression
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2015-07-17T17:42:00Z
Last change time
2015-07-24T03:20:23Z
Keywords
performance, pull
Assigned to
nobody
Creator
wyrlon

Comments

Comment #0 by wyrlon — 2015-07-17T17:42:11Z
struct Struct { ushort one; } auto dummy = new Struct[513*513]; The above program takes ~50s to compile on a modern computer. No difference between: v2.067.1 v2.068.0-b1
Comment #1 by gassa — 2015-07-17T17:57:21Z
Same here. Maybe it generates an instance of the array at compile time? Compile-time function execution is known to be slow. Interestingly, void main () {auto dummy = new Struct[513 * 513];} and even void main () {enum dummy = new Struct[513 * 513];} compile just fine.
Comment #2 by ag0aep6g — 2015-07-17T18:39:58Z
Probably related to the very similar issue 14571.
Comment #3 by ag0aep6g — 2015-07-18T18:59:04Z
Digger says this has been introduced by https://github.com/D-Programming-Language/dmd/pull/2681
Comment #4 by ketmar — 2015-07-18T22:23:10Z
(In reply to Ivan Kazmenko from comment #1) > Maybe it generates an instance of the array at compile time? it is, indeed. `auto dummy = new Struct[513*513];` can be evaluated in compile time, and compiler does exactly that. this will also produce a huge .o file with mostly zeroes (.init) inside.
Comment #5 by k.hara.pg — 2015-07-19T04:55:07Z
Comment #6 by github-bugzilla — 2015-07-21T07:27:00Z
Commits pushed to stable at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/27dc11712eb4ddd4d45033654f7d8cb93d7745d4 fix Issue 14805 - Unreasonably slow "new Struct[large]" https://github.com/D-Programming-Language/dmd/commit/35d35f1cf7c5e386f3c9c2f5ca76fc4f12f174e0 Merge pull request #4821 from 9rnsr/fix14805 [REG2.064] Issue 14805 - Unreasonably slow "new Struct[large]"
Comment #7 by github-bugzilla — 2015-07-24T03:20:23Z