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

C++ 中文周刊 2024-02-09 第148期

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

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

本期文章由 黄亮Anthony HNY 不语 赞助

大家新年快乐

资讯

boost 新增 charconv https://lists.boost.org/Archives/boost/2024/02/255821.php

把from_chars搬到c++11,我建议放弃c++11 ,2024了bro

文档 https://develop.charconv.cpp.al/

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

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

What’s New in vcpkg (January 2024) https://devblogs.microsoft.com/cppblog/whats-new-in-vcpkg-january-2024/

另外有个重写loki的活动哈,有点幽默,感兴趣可以看看 https://cppdepend.com/blog/loki-the-best-c-library-to-learn-design-patterns-lets-modernize-it/

(重写loki不是已经做了吗,folly啊)

brpc 发布了release note,我就不介绍了

文章

使用 hugetlb 提升性能 https://zhuanlan.zhihu.com/p/680950566

大页可以带来性能提升,什么SDDK都在用,不过话说 redis 为啥不用?避免影响rdb生成?COW开销太大?

另外这有个 hugetop命令hugetop

代码这里 https://gitlab.com/procps-ng/procps

C++异常的误用以及改进 https://zhuanlan.zhihu.com/p/681210803

群友翻译,非常干活,值得看看

不过异常设计的还是太傻呗了

[RFC] Upstreaming ClangIR https://discourse.llvm.org/t/rfc-upstreaming-clangir/76587/19

之前聊到的MLIR 在c/c++上的落地 CIR准备合入到LLVM

感觉clang明显更激进一些,而gcc还是一群老登

Option Soup: the subtle pitfalls of combining compiler flags https://hacks.mozilla.org/2024/01/option-soup-the-subtle-pitfalls-of-combining-compiler-flags/

傻逼locale问题,虽然你是静态连接libstdcxx-static,但是locale并不static

errno and libc https://dxuuu.xyz/errno.html

errno是内核设置还是libc设置?当然是libc

怎么验证?简单来说就是同一个系统调用,调用syscall/通过汇编调用,观察errno变化

asm

gcc 7.3 bug一例 class template argument deduction fails in new-expression

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85883

第八行有问题,低版本的gcc (现在低版本gcc指的是7/8了)用大括号绕过即可,为什么列这个呢,因为我遇到了

Unexpected Ways Memory Subsystem Interacts with Branch Prediction https://johnnysswlab.com/unexpected-ways-memory-subsystem-interacts-with-branch-prediction/

分支预测非常影响性能。这里介绍了几个branchfree写法并且对比了性能,

代码 https://github.com/ibogosavljevic/johnysswlab/blob/master/2023-12-branches-memory/binary_search.cpp#L53

Array Size (in elements)

Original

Conditional Moves

Arithmetics

4 K

Runtime: 0.22 sInstr: 434 M CPI: 1.96Mem. Data Volume: 0.45 GB

Runtime: 0.14 sInstr: 785 MCPI: 0.728Mem. Data Volume: 0.25 GB

Runtime: 0.19 sInstr: 1.102 MCPI: 0.69Mem. Data Volume: 0.32 GB

16 K

Runtime: 0.26 sInstr: 511 MCPI: 2.01Mem. Data Volume: 0.49 GB

Runtime: 0.19 sInstr: 928 MCPI: 0.77Mem. Data Volume: 0.39 GB

Runtime: 0.24 sInstr: 1.308 MCPI: 0.72Mem. Data Volume: 0.46 GB

64 K

Runtime: 0.32 sInstr: 584 MCPI: 2.143Mem. Data Volume: 0.48 GB

Runtime: 0.24 sInstr: 1.064 MCPI: 0.90Mem. Data Volume: 0.25 GB

Runtime: 0.31Instr: 1.504CPI: 0.82Mem. Data Volume: 0.26 GB

256 K

Runtime: 0.43 sInstr: 646 MCPI: 2.59Mem. Data Volume: 0.36 GB

Runtime: 0.39 sInstr: 1.199 MCPI: 1.28Mem. Data Volume: 0.32 GB

Runtime: 0.47 sInstr: 1.698 MCPI: 1.09Mem. Data Volume: 0.36 GB

1 M

Runtime: 0.56 sInstr: 727 MCPI: 3.05Mem. Data Volume: 0.67 GB

Runtime: 0.59 sInstr: 1.333 MCPI: 1.72Mem. Data Volume: 0.59 GB

Runtime: 0.70 sInstr: 1.891 MCPI: 1.42Mem. Data Volume: 0.68 GB

4 M

Runtime: 1.127 sInstr: 798 MCPI: 4.65Mem. Data Volume: 9.94 GB

Runtime: 1.48 sInstr: 1.467 MCPI: 3.1Mem. Data Volume: 3.75 GB

Runtime: 1.59 sInstr: 2.084 MCPI: 2.45Mem. Data Volume: 3.9 GB

16 M

Runtime: 1.65 sInstr: 870 MCPI: 6.26Mem. Data Volume: 18.48 GB

Runtime: 2.75 sInstr: 1.601CPI: 4.16Mem. Data Volume: 6.95 GB

Runtime: 2.90 sInstr: 2.277 MCPI: 3.18Mem. Data Volume: 7.05 GB

课外阅读

快排代码

代码在这里 https://github.com/ibogosavljevic/johnysswlab/blob/master/2022-01-sort/

感觉值得展开讲讲。我找作者要了授权,后面还会继续介绍这个

number parsing https://www.cppstories.com/2024/constexpr-number-parsing-cpp23/

有句讲句 from_chars接口有点难用

可以用结构化绑定,更好看一点

c++26可以直接这么用

解析时间字符串 https://www.meetingcpp.com/blog/items/Converting-a-string-view-to-a-time-point-in-Cpp20.html

没有std::chrono::parse?

怎么测试编译器 Testing the MSVC Compiler Backend https://devblogs.microsoft.com/cppblog/testing-the-msvc-compiler-backend/

有点意思

视频

cppcon最近更新了几个重量级的工具类视频,重构,分析,我准备本地复现一下,目前就不总结了,单独发

开源项目介绍

  • • asteria[2] 一个脚本语言,可嵌入,长期找人,希望胖友们帮帮忙,也可以加群753302367和作者对线
  • • Unilang[3] deepin的一个通用编程语言,点子有点意思,也缺人,感兴趣的可以github讨论区或者deepin论坛看一看。这里也挂着长期推荐了
  • • StringZilla 3.0版本,给了一些压测数据,挺有意思。主要思路就是simd加速 https://github.com/ashvardanian/StringZilla/releases/tag/v3.0.0
  • • https://github.com/fredrikwidlund/libreactorng 纯c + iouring web库
本文参与 腾讯云自媒体同步曝光计划,分享自微信公众号。
原始发表:2024-02-09,如有侵权请联系 cloudcommunity@tencent.com 删除

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

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

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

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • 资讯
  • 文章
    • 使用 hugetlb 提升性能 https://zhuanlan.zhihu.com/p/680950566
      • C++异常的误用以及改进 https://zhuanlan.zhihu.com/p/681210803
        • [RFC] Upstreaming ClangIR https://discourse.llvm.org/t/rfc-upstreaming-clangir/76587/19
          • Option Soup: the subtle pitfalls of combining compiler flags https://hacks.mozilla.org/2024/01/option-soup-the-subtle-pitfalls-of-combining-compiler-flags/
            • errno and libc https://dxuuu.xyz/errno.html
              • gcc 7.3 bug一例 class template argument deduction fails in new-expression
                • Unexpected Ways Memory Subsystem Interacts with Branch Prediction https://johnnysswlab.com/unexpected-ways-memory-subsystem-interacts-with-branch-prediction/
                  • number parsing https://www.cppstories.com/2024/constexpr-number-parsing-cpp23/
                    • 解析时间字符串 https://www.meetingcpp.com/blog/items/Converting-a-string-view-to-a-time-point-in-Cpp20.html
                      • 怎么测试编译器 Testing the MSVC Compiler Backend https://devblogs.microsoft.com/cppblog/testing-the-msvc-compiler-backend/
                      • 视频
                      • 开源项目介绍
                      领券
                      问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档