snappy: optimize UnalignedCopy64 and IncrementalCopy for RISC-V (#3360)

* snappy: optimize UnalignedCopy64 and IncrementalCopy for RISC-V

Use RISC-V inline assembly (ld/sd) for 8-byte copy operations instead
of generic macro-based implementation.

Changes:
- UnalignedCopy64: direct ld/sd pair for 8-byte copy
- IncrementalCopy: 8-byte bulk copies when source/dest don't overlap

Performance improvement (direct function benchmark):
- Decompress compressible-256K: 728 MB/s -> 2205 MB/s (+203%)
- Decompress zeros-256K: 543 MB/s -> 1462 MB/s (+169%)

Tests: brpc_snappy_compress_unittest passed (7/7)

Signed-off-by: Xiaofei Gong <gongxiaofei24@iscas.ac.cn>
Signed-off-by: YuanSheng <yuansheng@isrc.iscas.ac.cn>

* snappy: add alignment check for RISC-V ld/sd optimization

Address Copilot review: ld/sd require 8-byte alignment. Add runtime
alignment check and fall back to memcpy/byte-copy for unaligned
addresses to avoid traps on implementations that don't support
misaligned access.

Signed-off-by: Xiaofei Gong <gongxiaofei24@iscas.ac.cn>
Signed-off-by: YuanSheng <yuansheng@isrc.iscas.ac.cn>

---------

Signed-off-by: Xiaofei Gong <gongxiaofei24@iscas.ac.cn>
Signed-off-by: YuanSheng <yuansheng@isrc.iscas.ac.cn>
2 files changed
tree: ac437babbdea7ed48dc54afc2fed9ca70b6d02e7
  1. .github/
  2. bazel/
  3. cmake/
  4. community/
  5. docs/
  6. example/
  7. homebrew-formula/
  8. java/
  9. package/
  10. python/
  11. registry/
  12. src/
  13. test/
  14. tools/
  15. .asf.yaml
  16. .bazelignore
  17. .bazelrc
  18. .bazelversion
  19. .gitignore
  20. .licenserc.yaml
  21. AGENTS.md
  22. BUILD.bazel
  23. CHANGES.md
  24. CLAUDE.md
  25. CMakeLists.txt
  26. CODE_OF_CONDUCT.md
  27. config.h.in
  28. config_brpc.sh
  29. CONTRIBUTING.md
  30. Dockerfile
  31. LICENSE
  32. Makefile
  33. MODULE.bazel
  34. NOTICE
  35. README.md
  36. README_cn.md
  37. RELEASE_VERSION
  38. SECURITY.md
  39. THREAT_MODEL.md
  40. WORKSPACE
  41. WORKSPACE.bzlmod
README.md

中文版

Linux Build Status MacOs Build Status

brpc logo (light) brpc logo (dark)

bRPC is an Industrial-grade RPC framework using C++ Language, which is often used in high performance system such as Search, Storage, Machine learning, Advertisement, Recommendation etc.

“bRPC” means “better RPC”.

You can use it to:

Try it!

Contribute code

Please refer to here.

Feedback and Getting involved

Code of Conduct

We follow the code of conduct from Apache Software Foundation, please refer it here Link