Skip to content

Commit 17c1eb5

Browse files
committed
Revert "feat: using web worker to generate css"
This reverts commit fc8d79d.
1 parent dacfcf6 commit 17c1eb5

19 files changed

+1
-2176
lines changed

.github/workflows/docs-deploy.yml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ jobs:
4141
uses: actions/upload-pages-artifact@v3
4242
with:
4343
path: packages/docs/.vitepress/dist
44-
name: docs-artifact
4544

4645
deploy:
4746
environment:
@@ -54,6 +53,3 @@ jobs:
5453
- name: Deploy to GitHub Pages
5554
id: deployment
5655
uses: actions/deploy-pages@v4
57-
with:
58-
artifact_name: docs-artifact
59-
path: /

README.md

Lines changed: 0 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -186,47 +186,3 @@ const StyledDiv = styled.div`
186186

187187
- [styled-components](https://github.com/styled-components).
188188
- [stylis](https://github.com/thysultan/stylis)
189-
190-
## Worker性能测试
191-
192-
`vue-styled-components`使用Web Worker进行复杂样式计算,以避免阻塞主线程。我们提供了性能测试工具来比较Worker和主线程在不同场景下的性能差异。
193-
194-
### 运行测试
195-
196-
```bash
197-
# 在浏览器中运行可视化性能测试
198-
npm run test:worker
199-
200-
# 在命令行中运行性能测试
201-
npm run benchmark:worker
202-
```
203-
204-
### 测试代码结构
205-
206-
性能测试相关的代码位于项目根目录的`worker-benchmark`文件夹中:
207-
208-
- `worker-benchmark.ts` - 核心的基准测试实现
209-
- `worker-performance.ts` - 单元测试形式的性能测试
210-
- `api.ts` - 提供用于基准测试和可视化的API
211-
- `worker-demo.html` - 带有图表显示的可视化测试页面
212-
213-
### 测试场景
214-
215-
测试覆盖以下几个场景:
216-
217-
1. **简单样式计算** - 少量简单的CSS规则
218-
2. **复杂样式计算** - 多个复杂的CSS规则
219-
3. **大量样式计算** - 大量的CSS规则,模拟大型应用场景
220-
4. **混合样式计算** - 混合简单和复杂的CSS规则
221-
5. **阈值边界测试** - 测试接近复杂度阈值的场景
222-
6. **Worker不可用场景** - 模拟Worker不可用时的回退机制
223-
224-
### 性能优化
225-
226-
根据测试结果,我们实现了智能的样式计算策略:
227-
228-
- 对于简单样式(规则数量少于阈值),直接在主线程中计算,避免Worker创建和通信开销
229-
- 对于复杂样式,使用Worker异步计算,避免阻塞主线程
230-
- 当Worker不可用时,自动回退到主线程计算
231-
232-
这种策略在保持良好性能的同时,确保了样式计算的可靠性和兼容性。

package.json

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,7 @@
1313
"lint:fix": "eslint . --fix",
1414
"typecheck": "vue-tsc --noEmit",
1515
"prepare": "husky",
16-
"release": "semantic-release",
17-
"benchmark:worker": "pnpm -F worker-benchmark start"
16+
"release": "semantic-release"
1817
},
1918
"devDependencies": {
2019
"@antfu/eslint-config": "^4.4.0",
@@ -31,7 +30,6 @@
3130
"husky": "^9.0.11",
3231
"jsdom": "^25.0.1",
3332
"semantic-release": "^24.1.0",
34-
"tsx": "^4.19.4",
3533
"typescript": "^5.7.2",
3634
"vite": "^6.1.6",
3735
"vite-plugin-dts": "^4.0.3",

packages/core/__tests__/performance.test.ts

Lines changed: 0 additions & 158 deletions
This file was deleted.

packages/core/__tests__/styleManagement.test.ts

Lines changed: 0 additions & 106 deletions
This file was deleted.

0 commit comments

Comments
 (0)