サイボウズ社内ではC++で開発している製品があります。 未知のバッファオーバーランなどの脆弱性への対策として、重要なコンポーネントについてはプロダクション環境で利用しているバイナリでも AddressSanitizer を有効にしてビルドしています。 その製品で利用しているコンパイラをgcc5.3.0からgcc7.5.0に更新したところ性能劣化が発生しました。 製品コードとは別の部分が原因のため、根本原因の追跡が難しそうです。perf,bpftraceを使って性能劣化を追いかけてみましょう。 本記事で利用しているAddressSanitizer, bpftrace, perfコマンドはネット上に良質な記事がありますので、使い方などの解説は今回は省略させていただきます。 gcc7.5.0において、性能劣化が発生する再現コードとして次のようなものを用意しました。 #include <strin
初めに サイボウズ・ラボの光成です。 C++で単精度配列に対する指数関数のベクトル化をAVX-512を使って実装しました。 標準関数std::exp(float)に対する相対誤差は2e-6、速度は10倍ぐらいです。 指数関数をどうやって計算するのか、一般的な話とAVX-512に特有の部分を紹介します。 想定読者 C++とx64(x86-64)のアセンブリ言語の知識を多少仮定しますが、 なるべく少ない前提知識で読めるように心がけます。 ある程度知識のある方は近似計算から読み始めてかまいません。 初めに 想定読者 実行環境 ベンチマーク 速度 誤差 exp(x)の性質 計算の範囲 近似計算 アルゴリズム AVX-512での実装 AVX-512の命令概略 初期化 メインループ floatのフォーマット floatからintへの変換 端数処理 係数の決め方 まとめ 実行環境 AVX-512が使える
Github: http://github.com/ncm/nytm-spelling-bee Reddit: https://redd.it/42qc78 If Rust is to take on work previously reserved to C++, we need to know how well it does what C++ does best. What’s fast, what’s slow? What’s harder to do, what’s easier? I wouldn’t know how to look up answers for those questions, but I can write programs. I had a C++ program that was just the right length to experiment
At Realm, we’re always looking for ways to optimize for speed. This is the story of how we developed our own fast binary search function, with an execution time on average 24% faster than the C++ STL. Why Binary Search? Realm stores data in binary tree structures. For example, suppose Realm was holding objects with the following IDs in a linked list: If you wanted to find the object with ID equale
Why does this bit of code, const float x[16] = { 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9, 2.0, 2.1, 2.2, 2.3, 2.4, 2.5, 2.6}; const float z[16] = {1.123, 1.234, 1.345, 156.467, 1.578, 1.689, 1.790, 1.812, 1.923, 2.034, 2.145, 2.256, 2.367, 2.478, 2.589, 2.690}; float y[16]; for (int i = 0; i < 16; i++) { y[i] = x[i]; } for (int j = 0; j < 9000000; j++) { for (int i = 0; i < 16; i++) { y[i] *=
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
処理を実行中です
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く