Issue metadata
Sign in to add a comment
|
extensions::APIFeatureProvider::APIFeatureProvider compiles to 200KB of code |
||||||||||||||||||||||||
Issue descriptionIn an official build, this function compiles into 200KB of code. The function (from generated code: https://cs.chromium.org/chromium/src/out/Debug/gen/chrome/common/extensions/api/api_features.cc?rcl=0&l=18) is fairly large, but this is surprisingly large! Similarly, extensions::PermissionFeatureProvider::PermissionFeatureProvider compiles into 150+KBof code. I looked at the disassembly and a large portion appears to be the result of constructing std::strings. However, the disassembly is also interesting. Starting at 0x160553, there's a huge block of jumps which all look very similar: 0x0000000001a1f0c9 <+160553>: add $0xfffffffffffffff8,%rax 0x0000000001a1f0cd <+160557>: cmpq $0x0,0x4aaaec3(%rip) # 0x64c9f98 0x0000000001a1f0d5 <+160565>: je 0x1a25929 <extensions::APIFeatureProvider::APIFeatureProvider()+187273> 0x0000000001a1f0db <+160571>: mov $0xffffffff,%ecx 0x0000000001a1f0e0 <+160576>: lock xadd %ecx,(%rax) 0x0000000001a1f0e4 <+160580>: jmpq 0x1a25930 <extensions::APIFeatureProvider::APIFeatureProvider()+187280> 0x0000000001a1f0e9 <+160585>: add $0xfffffffffffffff8,%rax 0x0000000001a1f0ed <+160589>: cmpq $0x0,0x4aaaea3(%rip) # 0x64c9f98 0x0000000001a1f0f5 <+160597>: je 0x1a2594d <extensions::APIFeatureProvider::APIFeatureProvider()+187309> 0x0000000001a1f0fb <+160603>: mov $0xffffffff,%ecx 0x0000000001a1f100 <+160608>: lock xadd %ecx,(%rax) 0x0000000001a1f104 <+160612>: jmpq 0x1a25954 <extensions::APIFeatureProvider::APIFeatureProvider()+187316> 0x0000000001a1f109 <+160617>: add $0xfffffffffffffff8,%rax 0x0000000001a1f10d <+160621>: cmpq $0x0,0x4aaae83(%rip) # 0x64c9f98 0x0000000001a1f115 <+160629>: je 0x1a2596b <extensions::APIFeatureProvider::APIFeatureProvider()+187339> 0x0000000001a1f11b <+160635>: mov $0xffffffff,%ecx 0x0000000001a1f120 <+160640>: lock xadd %ecx,(%rax) 0x0000000001a1f124 <+160644>: jmpq 0x1a25972 <extensions::APIFeatureProvider::APIFeatureProvider()+187346> Incidentally, this is the last 40KB of the function or so. I think we can probably use a combination of StringPiece / const char* to get some easy codesize wins here, but I'm wondering if there are potential codegen improvements to make in clang here.
,
Jul 29 2016
Nice work. Perhaps the compiler should have avoided doing so much inlining, but making calls to lots of STL functions is also not cheap, so this seems better. I assume this saved code space on other platforms as well?
,
Jul 29 2016
Yeah, this helped Mac and Windows as well. See the graphs on https://chromeperf.appspot.com/report?sid=9401ee2b031ddfa3bcde52eae6cf602d840150a0088911fd315fa1d50aa3e5fa (I'm not sure how to specify a revision range, but r407500+ was where size increased by a bunch, and r408350+ is where it decreased. That being said, it didn't seem to help Windows as much, so there might be other codegen issues there. Unfortunately, I can't currently investigate on Windows. Also, see issue 631416 , which is where the perf sheriffs noticed this increase.
,
Jul 29 2016
I'm going to dupe this into 631416 so we can track the followup work on Windows there. |
|||||||||||||||||||||||||
►
Sign in to add a comment |
|||||||||||||||||||||||||
Comment 1 by bugdroid1@chromium.org
, Jul 28 2016