RSS https://github.com/wanghenshui/cppweeklynews/releases.atom
欢迎投稿,推荐或自荐文章/软件/资源等评论区留言
本期文章由 黄亮Anthony HNY 赞助
标准委员会动态/ide/编译器信息放在这里
编译器信息最新动态推荐关注hellogcc公众号 本周更新 2024-01-03 第235期
看个乐呵, 了解概念对于CPU运行还是有点理解的
LLVM知识,学吧,都是知识,早晚碰到
jemalloc最新知识,学吧
编译很慢,怎么抓?
ftime-trace的数据可以放到浏览器的tracing里,比如 chrome://tracing/
firefox可以用这个 https://profiler.firefox.com/from-url/https%3A%2F%2Fvitaut.net%2Ffiles%2F2024-hello-before.json/marker-chart/?globalTrackOrder=0&hiddenLocalTracksByPid=65312-fwx3&thread=0&timelineType=category&v=10
我没看懂他是怎么分析出头文件的耗时的,总之,把string前向声明一下
但是这种接口编译不过
因为basic_string<char>
找不到实现,怎么破?
然后这个操作就省掉了大量编译时间
结构是这样的
能不能换成make_shared?不能,因为是private继承
怎么破?
deque msvc实现有坑爹的地方
gcc | clang | msvc | |
---|---|---|---|
Block size | as many as fit in 512 bytes but at least 1 element | as many as fit in 4096 bytes but at least 16 elements | power of 2 that fits in 16 bytes but at least 1 element |
Initial map size | 8 | 2 | 8 |
Map growth | 2× | 2× | 2× |
Map shrinkage | On request | On request | On request |
Initial first/last | Center | Start | Start |
Members | block** map; size_t map_size;iterator first;iterator last; | block** map;block** first_block;block** last_block;block** end_block;size_t first;size_t size; | block** map; size_t map_size;size_t first;size_t size; |
Map layout | counted array | simple_deque | counted array |
Valid range | Pair of iterators | Start and count | Start and count |
Iterator | T* current;T* current_block_begin;T* current_block_end;block** current_block; | T* current; block** current_block; | deque* parent;size_t index; |
begin()/end() | Copy first and last. | Break first and first + size into block index and offset. | Break first and first + size into block index and offset. |
Spare blocks | Aggressively pruned | Keep one on each end | Keep all |
block size太小了
介绍协程并写了个co curl 有点意思,视频我也传B站了
https://www.bilibili.com/video/BV1NG411B7Fy/
代码在这里 https://github.com/hanickadot/co_curl
编译期物理计算的