Skip to content

Commit

Permalink
feat(canyon-backend): add compress test
Browse files Browse the repository at this point in the history
  • Loading branch information
zhangtao25 committed Oct 17, 2024
1 parent 8a91e2f commit c2b27da
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 2 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"migrate": "prisma migrate dev --schema ./packages/canyon-backend/prisma/schema.prisma",
"preinstall": "node ./scripts/check.js",
"prepare": "husky",
"format": "pnpm -r do-test"
"test": "pnpm -r do-test"
},
"devDependencies": {
"@commitlint/cli": "^19.5.0",
Expand Down
30 changes: 29 additions & 1 deletion packages/canyon-backend/test/utils/README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,30 @@
# 压缩测试
# Zstd+Protobuf 压缩与 Zstd 直接压缩比较

安装pnpm、nodejs18以上版本后,执行以下命令:

```bash
pnpm install
cd packages/canyon-backend
pnpm run do-test
```

## 一、压缩耗时
- **Zstd+Protobuf 压缩**:13 ms
- **Zstd 直接压缩**:6 ms

可以看出 Zstd 直接压缩在压缩耗时上更具优势。

## 二、压缩前大小
两种压缩方式的压缩前大小均为 72971b。

## 三、压缩后大小
- **Zstd+Protobuf 压缩**:9596b
- **Zstd 直接压缩**:11292b

Zstd+Protobuf 压缩后的大小更小。

## 四、压缩率
- **Zstd+Protobuf 压缩**:86.85%
- **Zstd 直接压缩**:84.53%

Zstd+Protobuf 压缩的压缩率更高。

0 comments on commit c2b27da

Please sign in to comment.