前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >C++ 中文周刊 第145期

C++ 中文周刊 第145期

作者头像
王很水
发布2024-07-30 14:50:58
1320
发布2024-07-30 14:50:58
举报
文章被收录于专栏:C++ 动态新闻推送

RSS https://github.com/wanghenshui/cppweeklynews/releases.atom

欢迎投稿,推荐或自荐文章/软件/资源等评论区留言

本期文章由 黄亮Anthony HNY 赞助

资讯

标准委员会动态/ide/编译器信息放在这里

编译器信息最新动态推荐关注hellogcc公众号 本周更新 2024-01-03 第235期

文章

现代分支预测:从学术界到工业界 https://zhuanlan.zhihu.com/p/675456587?utm_psn=1727335890022830082

看个乐呵, 了解概念对于CPU运行还是有点理解的

LLVM中指令选择的流程是啥样的?https://zhuanlan.zhihu.com/p/675543769?utm_psn=1727335764789129217

LLVM知识,学吧,都是知识,早晚碰到

数据结构】Jemalloc中的Radix Tree https://zhuanlan.zhihu.com/p/675177015?utm_psn=1727335511331631104
解析Jemalloc的关键数据结构 https://zhuanlan.zhihu.com/p/671608149?utm_psn=1727335367877697536

jemalloc最新知识,学吧

Optimizing the unoptimizable: a journey to faster C++ compile times https://vitaut.net/posts/2024/faster-cpp-compile-times/

编译很慢,怎么抓?

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>找不到实现,怎么破?

然后这个操作就省掉了大量编译时间

Why doesn’t my code compile when I change a shared_ptr(p) to an equivalent make_shared(p)? https://devblogs.microsoft.com/oldnewthing/20240103-00/?p=109228

结构是这样的

能不能换成make_shared?不能,因为是private继承

怎么破?

c++ tip of week 反射一例
Inside STL: The deque, implementation https://devblogs.microsoft.com/oldnewthing/20230810-00/?p=108587

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

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太小了

windows相关
  • • How to allocate address space with a custom alignment or in a custom address region https://devblogs.microsoft.com/oldnewthing/20231229-00/?p=109204
  • • How do I prevent my ATL class from participating in COM aggregation? DECLARE_NOT_AGGREGATABLE didn’t work https://devblogs.microsoft.com/oldnewthing/20240101-00/?p=109214
  • • The case of the vector with an impossibly large size https://devblogs.microsoft.com/oldnewthing/20240105-00/?p=109242

视频

What we've been (a)waiting for? - Hana Dusíková - Meeting C++ 2023 https://www.youtube.com/watch?v=_Q9tiEa-jG4&ab_channel=MeetingCpp

介绍协程并写了个co curl 有点意思,视频我也传B站了

https://www.bilibili.com/video/BV1NG411B7Fy/

代码在这里 https://github.com/hanickadot/co_curl

开源项目更新/新项目介绍

  • • fmt10.2更新,支持duration打印 %j 还支持这么玩
  • • mp-units 2.1.0 released! https://mpusz.github.io/mp-units/2.2/blog/2023/12/09/mp-units-210-released/

编译期物理计算的

  • • nanobind https://nanobind.readthedocs.io/en/latest/benchmark.html 一个python binding,速度性能都不错,群友kenshin推荐
  • • https://github.com/lhmouse/asteria 一个脚本语言,可嵌入,长期找人,希望胖友们帮帮忙,也可以加群753302367和作者对线
  • • Unilang https://github.com/linuxdeepin/unilang deepin的一个通用编程语言,点子有点意思,也缺人,感兴趣的可以github讨论区或者deepin论坛看一看。这里也挂着长期推荐了
本文参与 腾讯云自媒体同步曝光计划,分享自微信公众号。
原始发表:2024-01-08,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 CPP每周推送 微信公众号,前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • 资讯
  • 文章
    • 现代分支预测:从学术界到工业界 https://zhuanlan.zhihu.com/p/675456587?utm_psn=1727335890022830082
      • LLVM中指令选择的流程是啥样的?https://zhuanlan.zhihu.com/p/675543769?utm_psn=1727335764789129217
        • 数据结构】Jemalloc中的Radix Tree https://zhuanlan.zhihu.com/p/675177015?utm_psn=1727335511331631104
          • 解析Jemalloc的关键数据结构 https://zhuanlan.zhihu.com/p/671608149?utm_psn=1727335367877697536
            • Optimizing the unoptimizable: a journey to faster C++ compile times https://vitaut.net/posts/2024/faster-cpp-compile-times/
              • Why doesn’t my code compile when I change a shared_ptr(p) to an equivalent make_shared(p)? https://devblogs.microsoft.com/oldnewthing/20240103-00/?p=109228
                • c++ tip of week 反射一例
                  • Inside STL: The deque, implementation https://devblogs.microsoft.com/oldnewthing/20230810-00/?p=108587
                    • windows相关
                    • 视频
                      • What we've been (a)waiting for? - Hana Dusíková - Meeting C++ 2023 https://www.youtube.com/watch?v=_Q9tiEa-jG4&ab_channel=MeetingCpp
                      • 开源项目更新/新项目介绍
                      领券
                      问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档