Bug 10716 – Horrifically slow compilation for array literals inside functions

Status
RESOLVED
Resolution
DUPLICATE
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2013-07-26T03:19:00Z
Last change time
2017-07-05T15:18:57Z
Assigned to
nobody
Creator
clugdbug

Comments

Comment #0 by clugdbug — 2013-07-26T03:19:49Z
I found this in the DMD test suite. One file, test44.d, takes much longer to compile than any of the others. The actual test is basically just this: --- void main() { int [] x = [ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, ]; } --- but copy the 1,1,1,1, line a thousand times. The slow compilation happens in the glue layer: compiling with dmd -o- is instantaneous, but dmd -c takes minutes. Which is really silly since it can should just compile to a malloc + memcpy from data segment. Compiling with -O makes it even worse.
Comment #1 by bugzilla — 2013-07-26T19:44:18Z
Comment #2 by issues.dlang — 2013-07-26T20:06:03Z
This could be related to bug# 8449.
Comment #3 by github-bugzilla — 2013-08-13T18:08:56Z
Commits pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/9c97ebe61f85fef25bab8ff3d310a78fb56e38ba fix Issue 10716 - Horrifically slow compilation for array literals inside functions https://github.com/D-Programming-Language/dmd/commit/c9235a9ce3dc0e8dc97b4b9a9c8b83a31950e8f8 Merge pull request #2388 from WalterBright/fix10716 fix Issue 10716 - Horrifically slow compilation for array literals insid...
Comment #4 by yebblies — 2013-11-20T08:32:11Z
That pull didn't fix this.
Comment #5 by dlang-bugzilla — 2017-07-05T15:18:57Z
Fixed by https://github.com/dlang/dmd/pull/5085. *** This issue has been marked as a duplicate of issue 14886 ***