Optimizasyon seviyeleri

Başlatan z, 14 Mart 2013, 01:29:53

z

Kodumuz varsın uzun ama hızlı olsun dediğimizde bunun adı speed optimizsyon,
Yok kodumuz kısa olsun hızı yavaş olabilir dersek bunun adı da size optmizasyon.

Fakat örneğin Keile bakıyorum 4 seviyeden bahsediyor.

Bu seviyeler nasıl bir mantıkla belirleniyor? Nerede optimizasyon yapıyor?
Bana e^st de diyebilirsiniz.   www.cncdesigner.com

ErsinErce

#1
http://www.keil.com/support/man/docs/armcc/armcc_cjagadbi.htm
de birkaç açıklama mevcut ama pek tatmin edici değil
programın bazı yerlerini size bazı yerlerini speed optimizasyonu için tanımlayabiliyormuşuz bu da ekstra olsun  :)

Alıntı YapOptimization Levels can also be adjusted. The different levels of optimization allow you to trade off between the level
of debug information available in the compiled code, and the performance of the code. The following optimization levels
are available:
o -O0 applies minimum optimizations.
Most optimizations are switched off, and the code generated has the best debug view.
o -O1 applies restricted optimization.
For example, unused inline functions and unused static functions are removed. At this level of optimization, the
compiler also applies automatic optimizations such as removing redundant code and re-ordering instructions so
as to avoid an interlock situation. The code generated is reasonably optimized, with a good debug view.
o -O2 applies high optimization (This is the default setting).
Optimizations applied at this level take advantage of ARM's in-depth knowledge of the processor architecture,
to exploit processor-specific behavior of the given target. It generates well optimized code, but with limited
debug view.
o -O3 applies the most aggressive optimization.
The optimization is in accordance with the user's –Ospace/-Otime choice. By default, multi-file compilation is
enabled, which leads to a longer compile time, but gives the highest levels of optimization.

http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0491i/CIHGFGFB.html

Alıntı YapWhere num is one of the following:
0
Minimum optimization. Turns off most optimizations. It gives the best possible debug view and the lowest level of optimization.
1
Restricted optimization. Removes unused inline functions and unused static functions. Turns off optimizations that seriously degrade the debug view. If used with --debug, this option gives a satisfactory debug view with good code density.
2
High optimization. If used with --debug, the debug view might be less satisfactory because the mapping of object code to source code is not always clear.
This is the default optimization level.
3
Maximum optimization. -O3 performs the same optimizations as -O2 however the balance between space and time optimizations in the generated code is more heavily weighted towards space or time compared with -O2. That is:
-O3 -Otime aims to produce faster code than -O2 -Otime, at the risk of increasing your image size
-O3 -Ospace aims to produce smaller code than -O2 -Ospace, but performance might be degraded.
In addition, -O3 performs extra optimizations that are more aggressive, such as:
High-level scalar optimizations, including loop unrolling, for -O3 -Otime. This can give significant performance benefits at a small code size cost, but at the risk of a longer build time.
More aggressive inlining and automatic inlining for -O3 -Otime.
Note
The performance of floating-point code can be influenced by selecting an appropriate numerical model using the --fpmode option.
Note
Do not rely on the implementation details of these optimizations, because they might change in future releases.
Default
If you do not specify -Onum, the compiler assumes -O2.