[過去ログ] Go language part 4 (1002レス)
前次1-
抽出解除 必死チェッカー(本家) (べ) 自ID レス栞 あぼーん

このスレッドは過去ログ倉庫に格納されています。
次スレ検索 歴削→次スレ 栞削→次スレ 過去ログメニュー
995: デフォルトの名無しさん [sage] 2022/02/27(日) 06:52:35.32 ID:+yReYAPt(1/2) AAS
compiler explorer(外部リンク:godbolt.orgで、goコンパイル結果を普通のamd64用のアセンブラ見ること出来ないの?(Plan9でなく)
1000: デフォルトの名無しさん [sage] 2022/02/27(日) 08:16:41.16 ID:+yReYAPt(2/2) AAS
goroutineとC++標準ライブラリのスレッドを比較するために>>957
957(3): デフォルトの名無しさん [sage] 2022/02/26(土) 13:27:19 ID:fRC8OZTs(1/2) AAS
Goの(疑似スレッド+)goroutineのパフォーマンス計測っていいやつないの?
↓見つけたやつ
Goroutines Are Not Significantly Smaller Than Threads
外部リンク[html]:matklad.github.io
のmain.rsのC++版だけ作ってみた(ループは一桁減らした)
$ cat main.cc
#include <thread>
#include <chrono>
#include <vector>
using namespace std;
using namespace std::chrono;
int main() {
vector<unique_ptr<thread>> threads;
for (uint32_t i = 0; i < 1000; ++i) {
threads.emplace_back(
make_unique<thread>([=]{
uint64_t bad_hash = (i * 2654435761) % 200000;
this_thread::sleep_for(microseconds(bad_hash));
for (uint32_t _ = 0; _ < 1000; ++_) {
this_thread::sleep_for(10ms);
}
})
);
}
for (auto const& t: threads) {
t->join();
}
return 0;
}
$ g++ -O3 -pthread main.cc -o main && ./t ./main
real 11.04s
user 0.93s
sys 2.95s
rss 11328k
$
結果はmain.rsとほぼ同じで、やはりスレッド起動コストがデカく、rssもデカい
前次1-
スレ情報 赤レス抽出 画像レス抽出 歴の未読スレ AAサムネイル

ぬこの手 ぬこTOP 0.154s*