摘要: 我们在profiler的时候有的时候发现memset占用热点比较高。而且是std::vector::resize 带来的。这个明显是没必要的, 例如: std::vector<int> result; // 这里resize会 fill 0 result.resize(input_rows); fo 阅读全文
posted @ 2024-05-31 15:51 stdpain 阅读(1) 评论(0) 推荐(0) 编辑
摘要: format diff git diff -U0 HEAD^ | clang-format-diff-16 -p1 -i git hook .git/hooks/pre-commit #!/bin/bash STYLE=$(git config --get hooks.clangformat.sty 阅读全文
posted @ 2024-05-28 19:12 stdpain 阅读(2) 评论(0) 推荐(0) 编辑
摘要: C++11 实现 static constexpr 是按照const static 实现的,需要在 .cpp 中定义: // tmp.h class StatisTest { public: static constexpr const char literal[] = "xxx literal"; 阅读全文
posted @ 2024-05-28 17:37 stdpain 阅读(1) 评论(0) 推荐(0) 编辑
摘要: 随机丢10% sudo tc qdisc add dev eth0 root netem loss 10% 恢复 sudo tc qdisc del dev eth0 root 阅读全文
posted @ 2024-03-22 16:28 stdpain 阅读(6) 评论(0) 推荐(0) 编辑
摘要: // raw res == 0 ? 0 : (res < 0 ? -1 : 1) // from chat-gpt int compareSign(int A) { return (A > 0) - (A < 0); } // int compareSign(int A) { return (A > 阅读全文
posted @ 2024-03-04 17:27 stdpain 阅读(3) 评论(0) 推荐(0) 编辑
摘要: mysqlslap --concurrency=80 \ --number_of_queries=800 \ --query="select * from lineorder where lo_orderkey between 510 and 520" \ --delimiter=";" -h $H 阅读全文
posted @ 2024-01-23 11:18 stdpain 阅读(5) 评论(0) 推荐(0) 编辑
摘要: https://godbolt.org/z/rh6cK4acx atomic_int a = 10; if (++a == 10) { } if (a.fetch_add(1) == 9) { } 阅读全文
posted @ 2024-01-10 16:04 stdpain 阅读(10) 评论(0) 推荐(0) 编辑
摘要: 在CMake中,如果你有多个可执行文件目标,并且你想要它们在链接时串行构建,你可以使用CMake的add_dependencies命令来创建一个依赖链。这将确保在开始构建一个目标之前,它所依赖的目标已经构建完成。 下面是一个简化的步骤说明,展示了如何设置CMakeLists.txt来实现多个可执行文 阅读全文
posted @ 2023-12-22 15:45 stdpain 阅读(12) 评论(0) 推荐(0) 编辑
摘要: tuning https://www.yugabyte.com/blog/linux-performance-tuning-memory-disk-io/ https://blog.mi.hdm-stuttgart.de/index.php/2022/04/01/improve-your-stora 阅读全文
posted @ 2023-08-21 19:27 stdpain 阅读(15) 评论(0) 推荐(0) 编辑
摘要: change limit ``` cat /proc/$PID/limits prlimit -p $pid --core=unlimited:unlimited prlimit --pid $pid --nproc 65535:65535 ``` 阅读全文
posted @ 2023-06-26 14:34 stdpain 阅读(11) 评论(0) 推荐(0) 编辑