diff --git a/SUMMARY.md b/SUMMARY.md index c2548ef42de6f823ece0839c263ddbd05201850e..509f1af325e0cc4e446a7da0a6bd8004c97c93a7 100644 --- a/SUMMARY.md +++ b/SUMMARY.md @@ -20,6 +20,7 @@ * [龙蜥操作系统漏洞管理](./security_trust/anolis_cve_management.md) * [编程语言](./lang_runtime/README.md) * [Alibaba Dragonwell](./lang_runtime/dragonwell.md) + * [C++编译器和基础库](./lang_runtime/cpp_compiler_and_libs.md) * [社区基础设施](./dev_infra/README.md) * [T-One:全场景质量协作平台](./dev_infra/t-one.md) * [ABS:一站式构建平台](./dev_infra/abs.md) diff --git a/lang_runtime/cpp_compiler_and_libs.md b/lang_runtime/cpp_compiler_and_libs.md new file mode 100644 index 0000000000000000000000000000000000000000..3286bf02188cff450357d2833c02a6762f6fcf60 --- /dev/null +++ b/lang_runtime/cpp_compiler_and_libs.md @@ -0,0 +1,39 @@ +# Alibaba Cloud Compiler(LLVM) 和 C++ 基础库 +tags: 编程语言, Anolis8 +## 背景概述 +Alibaba Cloud Compiler(ACC)编译器,相比GCC,或其他Clang/LLVM版本在编译、构建速度上有很大的提升;利用ACC ThinLTO、AutoFDO和Bolt等技术可以在不同程度上优化程序性能。ACC在支持不同CPU架构(X86、AArch64)基础上,进一步针 对倚天710芯片进行优化,取得额外性能提升。 + +我们基于ACC编译器开发了一套贴近C++开发者、非常易用和高性能的C++基础库,包括:协程、modules、编译期反射、序列化、 rpc、http、orm等常用的组件。 + +ACC与C++基础库,为龙蜥社区开发者提供了C++ 开发的一站式解决方案,快速构建高性能的C++应用: +- 通过编译器切换升级到ACC,可以在不用大幅修改代码的情况下获得性能提升和编译速度大幅提升; +- 使用C++ 基础库的协程子库,将一些现存业务的同步任务造成协程异步任务可以获得性能的大幅提升; +- 使用C++ 基础库的协程子库将异步回调逻辑变成同步逻辑,让异步代码变得简单和易维护; +- 使用C++ 基础库的rpc、http、序列化和ORM等子库可以快速构建高性能C++应用。 + +## 技术方案 +**ACC ThinLTO性能优化** + +在一些业务中启用ThinLTO优化后,qps和cpu workload提升效果较好。 + +![thinLTO](../materials/imgs/lang_runtime/cpp_compiler_and_libs/cpp_compiler_thinlto.png) + +**ACC Bolt性能优化** + +在某存储平台中启用Bolt性能优化后,4K顺序写场景IOPS可提升8%,延时降低7.4%,优化效果明显。 + +**[async_simple协程库](https://github.com/alibaba/async_simple)** + +某计算平台和搜索平台将同步改造成协程异步之,qps获得了数量级的提升。将异步回调改造成协程异步之后性能获得了8%左右的提升。 + +**[struct_pack序列化库](https://github.com/alibaba/yalantinglibs/tree/main/include/struct_pack)** + +用户只需要一行代码就可以用struct_pack完成序列化和反序列化。相比于protobuf等开源库需要定义proto文件和生成代码的方式,大大简化了使用序列化库的使用方式。同时,相比protobuf性能提升7-20倍。 + +![struct_pack](../materials/imgs/lang_runtime/cpp_compiler_and_libs/cpp_struct_pack_bench.png) + +**[coro_rpc库](https://github.com/alibaba/yalantinglibs/tree/main/include/coro_rpc)** + +coro_rpc库是基于无栈协程和编译期反射的高性能易用的rpc库,几行代码就可以提供一个rpc服务,让异步IO变得简单,性能比 brpc高2-4倍。 + +![coro_rpc](../materials/imgs/lang_runtime/cpp_compiler_and_libs/cpp_coro_rpc_bench.png) diff --git a/materials/imgs/lang_runtime/cpp_compiler_and_libs/cpp_compiler_thinlto.png b/materials/imgs/lang_runtime/cpp_compiler_and_libs/cpp_compiler_thinlto.png new file mode 100644 index 0000000000000000000000000000000000000000..2aa7201c02c01e0baa44d5956f90f8c8b83875ab Binary files /dev/null and b/materials/imgs/lang_runtime/cpp_compiler_and_libs/cpp_compiler_thinlto.png differ diff --git a/materials/imgs/lang_runtime/cpp_compiler_and_libs/cpp_coro_rpc_bench.png b/materials/imgs/lang_runtime/cpp_compiler_and_libs/cpp_coro_rpc_bench.png new file mode 100644 index 0000000000000000000000000000000000000000..38be558aa3e030f6b5321b9ca61bf6ebb74a9a7a Binary files /dev/null and b/materials/imgs/lang_runtime/cpp_compiler_and_libs/cpp_coro_rpc_bench.png differ diff --git a/materials/imgs/lang_runtime/cpp_compiler_and_libs/cpp_struct_pack_bench.png b/materials/imgs/lang_runtime/cpp_compiler_and_libs/cpp_struct_pack_bench.png new file mode 100644 index 0000000000000000000000000000000000000000..80a10d4d8d1f297e5bc68f18b21e30d7d20753db Binary files /dev/null and b/materials/imgs/lang_runtime/cpp_compiler_and_libs/cpp_struct_pack_bench.png differ