Bug creation and email sending has been disabled, file new bugs at gcc.gnu.org/bugzilla
Bug 75 - 4x performance regression of to!(char[]) from gcd 4.6 to 4.8
Summary: 4x performance regression of to!(char[]) from gcd 4.6 to 4.8
Status: RESOLVED INVALID
Alias: None
Product: GDC
Classification: Unclassified
Component: libgdruntime (show other bugs)
Version: 4.8.x
Hardware: x86_64 Linux
: --- normal
Assignee: Iain Buclaw
URL:
Depends on:
Blocks:
 
Reported: 2013-08-21 10:00 CEST by Paul Jurczak
Modified: 2014-01-12 11:04 CET (History)
1 user (show)

See Also:


Attachments
Test code (763 bytes, application/octet-stream)
2013-08-21 10:00 CEST, Paul Jurczak
Details
-fdump-tree-original for gdc 4.6 (1.76 MB, text/plain)
2013-08-21 13:11 CEST, Paul Jurczak
Details
-fdump-tree-original for gdc 4.8 (189.12 KB, text/plain)
2013-08-21 13:12 CEST, Paul Jurczak
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Paul Jurczak 2013-08-21 10:00:18 CEST
Created attachment 50 [details]
Test code

This function:

int f(int N = 100_000) {   
   int len = 0;

   foreach (uint i; 1..N)
      len += to!(char[])(i).length; 

   return len;
}

runs 4 times slower when compiled with gcd 4.8 compared to gcd 4.6.

Run times and compilation details on Xubuntu 13.04 64-bit Core i5 3450S 2.8GHz (3.5GHz turbo):

5.7ms  GDC 4.6.4:     
gdc -m64 -march=native -fno-bounds-check -frename-registers -frelease -O3

23ms   GDC 4.8.1:     
gdc -m64 -march=native -fno-bounds-check -frename-registers -frelease -O3

22ms   LDC 0.11.0:    
ldmd2 -m64 -O -noboundscheck -inline -release

30ms   DMD64 2.063.2: 
dmd -O -noboundscheck -inline -release

Attached is test code.
Comment 1 Paul Jurczak 2013-08-21 10:05:59 CEST
This has probably little to do with GDC itself, but is related to changes in std.conv module. I could measure it only with gdc, hence I reported it here.
Comment 2 Iain Buclaw 2013-08-21 12:49:58 CEST
(In reply to comment #1)
> This has probably little to do with GDC itself, but is related to changes in
> std.conv module. I could measure it only with gdc, hence I reported it here.

Thanks for your bug report, there are some performance improvements to to!conv in the pipeline for 2.064, would be interesting to get test results then.

Also, can you compile the code with -fdump-tree-original for both 4.6 and 4.8 and attach the produced dumps to this report? 

As well as changes to library code, should also show if there's any changes to compiler code generation that may affect performance.

Thanks
Iain.
Comment 3 Paul Jurczak 2013-08-21 13:11:41 CEST
Created attachment 51 [details]
-fdump-tree-original for gdc 4.6
Comment 4 Paul Jurczak 2013-08-21 13:12:26 CEST
Created attachment 52 [details]
-fdump-tree-original for gdc 4.8
Comment 5 Paul Jurczak 2013-08-21 13:20:07 CEST
I added the files you requested, but they are syntactically different: assembly vs. D. I will be glad to run the new gdc version when available.
Comment 6 Iain Buclaw 2013-08-21 16:36:21 CEST
Argh! Completely forgot I switched to pretty-print dumps between 4.6->4.8. :)

Not to worry.
Comment 7 Johannes Pfau 2014-01-12 11:04:28 CET
I'll close this as invalid for now.

GDC-4.8 with 2.064 frontend is still ~30% faster than dmd 2.064 which seems reasonable. GDC-4.8/2.064 is also ~(3-4) times faster than LDC with 2.063 so it seems there were indeed some performance improvements with the 2.064 frontend release.

Anyway, if this is still an issue it's likely an upstream phobos issue, or the changes in 2.064 have already fixed it.

Feel free to reopen this issue if you disagree.