LoginSignup
0
0

HelloWorld本 第9章

Last updated at Posted at 2024-04-03

最適化

最適化とデバッグは背反の関係にある。
書籍のコードでは-O0は45バイト、-O1は44バイト、-O2は41バイト、-Osは44バイトである。
-Osは-O2の内、サイズを増大しないオプションを採用するはずだが、理由は不明である。

printfの最適化

-fno-builtinを使用しない場合、引数無しのprintfはputsに置換される。
putsは改行を加える為、文字列側の改行は除去され、実行ファイルの文字列検索はヒットしない可能性がある。

その他

timeコマンドのrealは実時間、userはユーザ時間、sysはカーネル時間である。
動的リンクの処理の為、共有ライブラリでは実行ステップ数が大幅に増加する。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0