Kenneth Endfinger
2016-01-08 22:11:06 UTC
I was browsing Hacker News, and I found this article
<https://matt.sh/howto-c>.
I was astonished when I saw this:
Compilation units
The most common way of building C projects is to decompose every source
file into an object file then link all the objects together at the end.
This procedure works great for incremental development, but it is
suboptimal for performance and optimization. Your compiler can't detect
potential optimization across file boundaries this way.
LTO â Link Time Optimization
LTO fixes the "source analysis and optimization across compilation units
problem" by annotating object files with intermediate representation so
source-aware optimizations can be carried out across compilation units at
link time (this slows down the linking process noticeably, but make -j
helps).
As of 2016, clang and gcc releases support LTO by just adding -flto to
your command line options during object compilation and final
library/program linking.
LTO still needs some babysitting though. Sometimes, if your program has
code not used directly but used by additional libraries, LTO can evict
functions or code because it detects, globally when linking, some code is
unused/unreachable and doesn't need to be included in the final linked
result.
I have debugged compilation issues for Dart before, and I never have seen
-flto in the commands.
So the question is: Is this something Dart could use, and would it actually
do anything useful?
<https://matt.sh/howto-c>.
I was astonished when I saw this:
Compilation units
The most common way of building C projects is to decompose every source
file into an object file then link all the objects together at the end.
This procedure works great for incremental development, but it is
suboptimal for performance and optimization. Your compiler can't detect
potential optimization across file boundaries this way.
LTO â Link Time Optimization
LTO fixes the "source analysis and optimization across compilation units
problem" by annotating object files with intermediate representation so
source-aware optimizations can be carried out across compilation units at
link time (this slows down the linking process noticeably, but make -j
helps).
As of 2016, clang and gcc releases support LTO by just adding -flto to
your command line options during object compilation and final
library/program linking.
LTO still needs some babysitting though. Sometimes, if your program has
code not used directly but used by additional libraries, LTO can evict
functions or code because it detects, globally when linking, some code is
unused/unreachable and doesn't need to be included in the final linked
result.
I have debugged compilation issues for Dart before, and I never have seen
-flto in the commands.
So the question is: Is this something Dart could use, and would it actually
do anything useful?
--
For other discussions, see https://groups.google.com/a/dartlang.org/
For HOWTO questions, visit http://stackoverflow.com/tags/dart
To file a bug report or feature request, go to http://www.dartbug.com/new
---
You received this message because you are subscribed to the Google Groups "Dart Misc" group.
To unsubscribe from this group and stop receiving emails from it, send an email to misc+***@dartlang.org.
For other discussions, see https://groups.google.com/a/dartlang.org/
For HOWTO questions, visit http://stackoverflow.com/tags/dart
To file a bug report or feature request, go to http://www.dartbug.com/new
---
You received this message because you are subscribed to the Google Groups "Dart Misc" group.
To unsubscribe from this group and stop receiving emails from it, send an email to misc+***@dartlang.org.