C/C++のコードの速度を改善するときに有効な方法は、処理時間を多く消費する関数を見極めて、その関数を改善することである。どの関数が(1)どれだけ処理時間を消費するか、(2)何度呼ばれているか、(3)どの関数を呼んでいる/どの関数に呼ばれているか、などを測定する行為をプロファイリングといい、その手助けをするツールをプロファイラと呼ぶ。今回はC/C++のプロファイラとして有名なgprofの使い方を紹介する。 プログラムの例 GNUプロファイラーによるコード処理速度の向上 のコードを参考にして作成した以下のコードをgprofでプロファイリングしてみよう。main()はa()とb()を100000回呼ぶ。b()はa()の約4倍時間を消費する。またmain()自身も、a()とb()を呼び出してその結果を待つ以外に、a()の約1/3の時間を消費する。 // main.cpp #include <cs
先日、プロフィール写真についての記事を扱いましたが、それに続いてプロフィールの書き方についての考察をしてみようと思います。 今回は「悪い例」を見ながら学んでいくという形式にするので、途中、読むに耐えない表現などがあると思いますが、我慢して読み進めていただければと思います。そもそも、人生なんて苦痛の連続でしかないわけですから、このくらいでへこたれていてはいけませんよ! また、この考察は、ネット上のプロフィールだけでなく、会社での自己紹介などでも応用可能なので、ご一読いただければ幸いです。 覚えてもらうまでがプロフィールです まず、大前提ですが、プロフィールとは、来訪者に自分を印象づけるために書くものです。適切なプロフィールを書くと、あなたに好感を持ってもらえ、その結果、ブログの固定客が増えたり、(粘液的な意味での)出会いがあったりしますし、逆に、自分の書きたいように書いた結果、読者への配慮の
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
処理を実行中です
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く