Skip to content

Commit

Permalink
57 docs add english documentation (#65)
Browse files Browse the repository at this point in the history
* translate docs by llm
  • Loading branch information
oathdruid authored Oct 22, 2024
1 parent f5f8797 commit c64dfd9
Show file tree
Hide file tree
Showing 98 changed files with 3,803 additions and 192 deletions.
87 changes: 87 additions & 0 deletions README.en.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
**[[简体中文]](README.zh-cn.md)**

# Babylon

[![CI](https://github.com/baidu/babylon/actions/workflows/ci.yml/badge.svg)](https://github.com/baidu/babylon/actions/workflows/ci.yml)
[![Coverage Status](https://coveralls.io/repos/github/baidu/babylon/badge.svg)](https://coveralls.io/github/baidu/babylon)

Babylon is a foundational library designed to support high-performance C++ server-side development. It provides a wide array of core components focusing on memory and parallelism management. This library is widely applied in scenarios with stringent performance requirements, such as search and recommendation engines, autonomous driving, etc.

## Core Features

- **Efficient application-level memory pool mechanism**
- Compatible with and extends the [std::pmr::memory_resource](https://en.cppreference.com/w/cpp/memory/memory_resource) mechanism.
- Integrates and enhances the [google::protobuf::Arena](https://protobuf.dev/reference/cpp/arenas) mechanism.
- Provides capacity reservation, cleanup, and reconstruction mechanisms when object pools are used in conjunction with memory pools.

- **Modular parallel computing framework**
- A high-performance automatic parallel framework based on lock-free DAG deduction.
- Provides a dataflow management scheme derived naturally from the execution flow, ensuring safe data race management in complex computation graph scenarios.
- Micro-pipeline parallel mechanism offering enhanced parallel capabilities.

- **Core components for parallel development**
- Wait-free concurrent-safe containers (vector/queue/hash_table/...).
- Traversable thread-local storage development framework.
- Extensible synchronization primitives supporting both threads and coroutines (future/mutex/...).

- **Foundational tools for application/framework construction**
- IOC component development framework.
- C++ object serialization framework.
- Zero-copy/zero-allocation asynchronous logging framework.

## Build and Usage

### Supported Platforms and Compilers

- **OS**: Linux
- **CPU**: x86-64/aarch64
- **COMPILER**: gcc/clang

### Bazel

Babylon uses [Bazel](https://bazel.build) for build management and [bzlmod](https://bazel.build/external/module) for dependency management. Given the ongoing transition of the Bazel ecosystem towards bzlmod, Babylon also compatible with the [workspace](https://bazel.build/rules/lib/globals/workspace) dependency management mode.

- [Depend with bazel using bzlmod](example/depend-use-bzlmod)
- [Depend with bazel using workspace](example/depend-use-workspace)

### CMake

Babylon also supports building with [CMake](https://cmake.org) and allows dependency management through [find_package](https://cmake.org/cmake/help/latest/command/find_package.html), [add_subdirectory](https://cmake.org/cmake/help/latest/command/add_subdirectory.html), or [FetchContent](https://cmake.org/cmake/help/latest/module/FetchContent.html).

- [Depend with CMake using FetchContent](example/depend-use-cmake-fetch)
- [Depend with CMake using find_package](example/depend-use-cmake-find)
- [Depend with CMake using add_subdirectory](example/depend-use-cmake-subdir)

## Module Documentation

- [:any](docs/any.en.md)
- [:anyflow](docs/anyflow/README.en.md)
- [:application_context](docs/application_context.en.md)
- [:concurrent](docs/concurrent/README.en.md)
- [:coroutine](docs/coroutine/README.en.md)
- [:executor](docs/executor.en.md)
- [:future](docs/future.en.md)
- [:logging](docs/logging/README.en.md)
- [Use async logger](example/use-async-logger)
- [Use with glog](example/use-with-glog)
- [:reusable](docs/reusable/README.en.md)
- [:serialization](docs/serialization.en.md)
- [:time](docs/time.en.md)
- Protobuf [arenastring](docs/arenastring.en.md) patch
- Typical usage with [brpc](https://github.com/apache/brpc)
- use [:future](docs/future.en.md) with bthread: [example/use-with-bthread](example/use-with-bthread)
- use [:reusable_memory_resource](docs/reusable/memory_resource.en.md) for rpc server: [example/use-arena-with-brpc](example/use-arena-with-brpc)
- use [:concurrent_counter](docs/concurrent/counter.en.md) implement bvar: [example/use-counter-with-bvar](example/use-counter-with-bvar)

## Design Philosophy (chinese version only)

- [Extreme optimizations by Baidu C++ engineers (Memory)](https://mp.weixin.qq.com/s?__biz=Mzg5MjU0NTI5OQ==&mid=2247489076&idx=1&sn=748bf716d94d5ed2739ea8a9385cd4a6&chksm=c03d2648f74aaf5e11298cf450c3453a273eb6d2161bc90e411b6d62fa0c1b96a45e411af805&scene=178&cur_album_id=1693053794688761860#rd)
- [Extreme optimizations by Baidu C++ engineers (Concurrency)](https://mp.weixin.qq.com/s/0Ofo8ak7-UXuuOoD0KIHwA)

## How to Contribute

If you encounter any issues or need new features, feel free to create an issue.

If you can solve an issue, you're welcome to submit a PR.

Before sending a PR, please ensure corresponding test cases are included.
82 changes: 0 additions & 82 deletions README.md

This file was deleted.

1 change: 1 addition & 0 deletions README.md
84 changes: 84 additions & 0 deletions README.zh-cn.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
**[[English]](README.en.md)**

# Babylon

[![CI](https://github.com/baidu/babylon/actions/workflows/ci.yml/badge.svg)](https://github.com/baidu/babylon/actions/workflows/ci.yml)
[![Coverage Status](https://coveralls.io/repos/github/baidu/babylon/badge.svg)](https://coveralls.io/github/baidu/babylon)

Babylon是一个用于支持C++高性能服务端开发的基础库,从内存和并行管理角度提供了大量的基础组件。广泛应用在对性能有严苛要求的场景,典型例如搜索推荐引擎,自动驾驶车载计算等场景

## 核心功能

- 高效的应用级内存池机制
- 兼容并扩展了[std::pmr::memory_resource](https://en.cppreference.com/w/cpp/memory/memory_resource)机制
- 整合并增强了[google::protobuf::Arena](https://protobuf.dev/reference/cpp/arenas)机制
- 在对象池结合内存池使用的情况下提供了保留容量清理和重建的机制
- 组件式并行计算框架
- 基于无锁DAG推导的高性能自动组件并行框架
- 依照执行流天然生成数据流管理方案,复杂计算图场景下提供安全的数据竞争管理
- 微流水线并行机制,提供上限更好的并行化能力
- 并行开发基础组件
- wait-free级别的并发安全容器(vector/queue/hash_table/...)
- 可遍历的线程缓存开发框架
- 可扩展支持线程/协程的同步原语(future/mutex/...)
- 应用/框架搭建基础工具
- IOC组件开发框架
- C++对象序列化框架
- 零拷贝/零分配异步日志框架

## 编译并使用

### 支持平台和编译器

- OS: Linux
- CPU: x86-64/aarch64
- COMPILER: gcc/clang

### Bazel

Babylon使用[Bazel](https://bazel.build)进行构建并使用[bzlmod](https://bazel.build/external/module)进行依赖管理,考虑到目前Bazel生态整体处于bzlmod的转换周期,Babylon也依然兼容[workspace](https://bazel.build/rules/lib/globals/workspace)依赖管理模式

- [Depend with bazel use bzlmod](example/depend-use-bzlmod)
- [Depend with bazel use workspace](example/depend-use-workspace)

### CMake

Babylon也支持使用[CMake](https://cmake.org)进行构建,并支持通过[find_package](https://cmake.org/cmake/help/latest/command/find_package.html)[add_subdirectory](https://cmake.org/cmake/help/latest/command/add_subdirectory.html)[FetchContent](https://cmake.org/cmake/help/latest/module/FetchContent.html)进行依赖引入

- [Depend with cmake use FetchContent](example/depend-use-cmake-fetch)
- [Depend with cmake use find_package](example/depend-use-cmake-find)
- [Depend with cmake use add_subdirectory](example/depend-use-cmake-subdir)

## 模块功能文档

- [:any](docs/any.zh-cn.md)
- [:anyflow](docs/anyflow/README.zh-cn.md)
- [:application_context](docs/application_context.zh-cn.md)
- [:concurrent](docs/concurrent/README.zh-cn.md)
- [:coroutine](docs/coroutine/README.zh-cn.md)
- [:executor](docs/executor.zh-cn.md)
- [:future](docs/future.zh-cn.md)
- [:logging](docs/logging/README.zh-cn.md)
- [Use async logger](example/use-async-logger)
- [Use with glog](example/use-with-glog)
- [:reusable](docs/reusable/README.zh-cn.md)
- [:serialization](docs/serialization.zh-cn.md)
- [:time](docs/time.zh-cn.md)
- Protobuf [arenastring](docs/arenastring.zh-cn.md) patch
- Typical usage with [brpc](https://github.com/apache/brpc)
- use [:future](docs/future.zh-cn.md) with bthread: [example/use-with-bthread](example/use-with-bthread)
- use [:reusable_memory_resource](docs/reusable/memory_resource.zh-cn.md) for rpc server: [example/use-arena-with-brpc](example/use-arena-with-brpc)
- use [:concurrent_counter](docs/concurrent/counter.zh-cn.md) implement bvar: [example/use-counter-with-bvar](example/use-counter-with-bvar)

## 整体设计思路

- [百度C++工程师的那些极限优化(内存篇)](https://mp.weixin.qq.com/s?__biz=Mzg5MjU0NTI5OQ==&mid=2247489076&idx=1&sn=748bf716d94d5ed2739ea8a9385cd4a6&chksm=c03d2648f74aaf5e11298cf450c3453a273eb6d2161bc90e411b6d62fa0c1b96a45e411af805&scene=178&cur_album_id=1693053794688761860#rd)
- [百度C++工程师的那些极限优化(并发篇)](https://mp.weixin.qq.com/s/0Ofo8ak7-UXuuOoD0KIHwA)

## 如何贡献

如果你遇到问题或需要新功能,欢迎创建issue。

如果你可以解决某个issue, 欢迎发送PR。

发送PR前请确认有对应的单测代码。
11 changes: 0 additions & 11 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -36,17 +36,6 @@ http_archive(
sha256 = '7b42b4d6ed48810c5362c265a17faebe90dc2373c885e5216439d37927f02926',
)

http_archive(
name = 'rules_foreign_cc',
urls = ['https://github.com/bazelbuild/rules_foreign_cc/releases/download/0.12.0/rules_foreign_cc-0.12.0.tar.gz'],
strip_prefix = 'rules_foreign_cc-0.12.0',
sha256 = 'a2e6fb56e649c1ee79703e99aa0c9d13c6cc53c8d7a0cbb8797ab2888bbc99a3',
)
load('@rules_foreign_cc//foreign_cc:repositories.bzl', 'rules_foreign_cc_dependencies')
rules_foreign_cc_dependencies()
load("@bazel_features//:deps.bzl", "bazel_features_deps")
bazel_features_deps()

http_archive(
name = 'rules_cuda',
urls = ['https://github.com/bazel-contrib/rules_cuda/releases/download/v0.2.3/rules_cuda-v0.2.3.tar.gz'],
Expand Down
22 changes: 22 additions & 0 deletions docs/README.en.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
**[[简体中文]](README.zh-cn.md)**

## Module Documentation

- [:any](any.en.md)
- [:anyflow](anyflow/README.en.md)
- [:application_context](application_context.en.md)
- [:concurrent](concurrent/README.en.md)
- [:coroutine](coroutine/README.en.md)
- [:executor](executor.en.md)
- [:future](future.en.md)
- [:logging](logging/README.en.md)
- [Use async logger](../example/use-async-logger)
- [Use with glog](../example/use-with-glog)
- [:reusable](reusable/README.en.md)
- [:serialization](serialization.en.md)
- [:time](time.en.md)
- Protobuf [arenastring](arenastring.en.md) patch
- Typical usage with [brpc](https://github.com/apache/brpc)
- use [:future](future.en.md) with bthread: [example/use-with-bthread](../example/use-with-bthread)
- use [:reusable_memory_resource](reusable/memory_resource.en.md) for rpc server: [example/use-arena-with-brpc](../example/use-arena-with-brpc)
- use [:concurrent_counter](concurrent/counter.en.md) implement bvar: [example/use-counter-with-bvar](../example/use-counter-with-bvar)
1 change: 1 addition & 0 deletions docs/README.md
22 changes: 22 additions & 0 deletions docs/README.zh-cn.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
**[[English]](README.en.md)**

# 模块功能文档

- [:any](any.zh-cn.md)
- [:anyflow](anyflow/README.zh-cn.md)
- [:application_context](application_context.zh-cn.md)
- [:concurrent](concurrent/README.zh-cn.md)
- [:coroutine](coroutine/README.zh-cn.md)
- [:executor](executor.zh-cn.md)
- [:future](future.zh-cn.md)
- [:logging](logging/README.zh-cn.md)
- [Use async logger](../example/use-async-logger)
- [Use with glog](../example/use-with-glog)
- [:reusable](reusable/README.zh-cn.md)
- [:serialization](serialization.zh-cn.md)
- [:time](time.zh-cn.md)
- Protobuf [arenastring](arenastring.zh-cn.md) patch
- Typical usage with [brpc](https://github.com/apache/brpc)
- use [:future](future.zh-cn.md) with bthread: [example/use-with-bthread](../example/use-with-bthread)
- use [:reusable_memory_resource](reusable/memory_resource.zh-cn.md) for rpc server: [example/use-arena-with-brpc](../example/use-arena-with-brpc)
- use [:concurrent_counter](concurrent/counter.zh-cn.md) implement bvar: [example/use-counter-with-bvar](../example/use-counter-with-bvar)
Loading

0 comments on commit c64dfd9

Please sign in to comment.