Compare commits

...

2 Commits

Author SHA1 Message Date
xfy
e12e59461b docs: 整理表格格式并添加 CI 链接
Some checks failed
CI / check (push) Successful in 12m26s
CI / build (push) Failing after 13m0s
2026-06-15 10:41:03 +08:00
xfy
f7288cc390 style: 格式化测试代码以符合 clippy 宽度限制 2026-06-15 10:40:00 +08:00
4 changed files with 45 additions and 22 deletions

View File

@ -41,26 +41,30 @@ hey -c 100 -n 100000 http://localhost:8080/
### Key Metrics to Watch
| Metric | Description |
|--------|-------------|
| Requests/sec | Throughput |
| Average latency | Mean response time |
| P99 latency | Tail latency |
| Status codes | Error rate (should be 0) |
| Metric | Description |
| -------------------- | ---------------------------- |
| Requests/sec | Throughput |
| Average latency | Mean response time |
| P99 latency | Tail latency |
| Status codes | Error rate (should be 0) |
| Latency distribution | Consistency (tight = stable) |
### Flame Graph Hotspots
| Expected Hotspot | Code Location | Cause |
|------------------|---------------|-------|
| SSR rendering | Dioxus framework | Virtual DOM diff + render per request |
| `deadpool` connection acquisition | `src/db/mod.rs` | Connection pool contention under concurrency |
| `moka` cache lookup | `src/cache.rs` | Cache hit/miss overhead |
| `tokio` scheduling | tokio runtime | Async task dispatch |
| `serde` serialization | Models | Post/User serialization |
| Expected Hotspot | Code Location | Cause |
| --------------------------------- | ---------------- | -------------------------------------------- |
| SSR rendering | Dioxus framework | Virtual DOM diff + render per request |
| `deadpool` connection acquisition | `src/db/mod.rs` | Connection pool contention under concurrency |
| `moka` cache lookup | `src/cache.rs` | Cache hit/miss overhead |
| `tokio` scheduling | tokio runtime | Async task dispatch |
| `serde` serialization | Models | Post/User serialization |
### Tuning
- `DB_POOL_SIZE` — increase if `deadpool` / `Semaphore` shows high in flame graph
- `SSR_CACHE_SECS` — increase to cache SSR output longer
- `TOKIO_WORKER_THREADS` — explicitly set worker thread count
## CI
https://git.rua.plus/api/v1/repos/xfy/yggdrasil/actions/tasks

View File

@ -176,8 +176,7 @@ mod tests {
#[test]
fn render_comment_link_data_uri_removed() {
let result =
render_comment_markdown("[click](data:text/html,<script>alert(1)</script>)");
let result = render_comment_markdown("[click](data:text/html,<script>alert(1)</script>)");
assert!(result.contains("click"));
assert!(!result.contains("data:"));
}

View File

@ -382,8 +382,12 @@ mod tests {
fn render_markdown_code_block() {
let result = render_markdown_enhanced("```rust\nfn main() {}\n```");
assert!(result.html.contains(r#"<pre><code class="language-rust">"#));
assert!(result.html.contains(r#"<span class="entity name function rust">main</span>"#));
assert!(result.html.contains(r#"<span class="storage type function rust">fn</span>"#));
assert!(result
.html
.contains(r#"<span class="entity name function rust">main</span>"#));
assert!(result
.html
.contains(r#"<span class="storage type function rust">fn</span>"#));
}
#[test]
@ -399,8 +403,12 @@ mod tests {
let result = render_markdown_enhanced("```html\n<script>alert(1)</script>\n```");
assert!(result.html.contains("<pre><code class=\"language-html\">"));
assert!(!result.html.contains("<script>"));
assert!(result.html.contains(r#"<span class="variable function js">alert</span>"#));
assert!(result.html.contains(r#"<span class="constant numeric js">1</span>"#));
assert!(result
.html
.contains(r#"<span class="variable function js">alert</span>"#));
assert!(result
.html
.contains(r#"<span class="constant numeric js">1</span>"#));
}
#[test]

View File

@ -217,18 +217,30 @@ mod tests {
#[test]
fn clean_tags_trims_whitespace() {
let input = vec![" rust ".to_string(), "\t\nwasm\t".to_string()];
assert_eq!(clean_tags(&input), vec!["rust".to_string(), "wasm".to_string()]);
assert_eq!(
clean_tags(&input),
vec!["rust".to_string(), "wasm".to_string()]
);
}
#[test]
fn clean_tags_filters_empty_strings() {
let input = vec!["".to_string(), " ".to_string(), "\t".to_string(), "valid".to_string()];
let input = vec![
"".to_string(),
" ".to_string(),
"\t".to_string(),
"valid".to_string(),
];
assert_eq!(clean_tags(&input), vec!["valid".to_string()]);
}
#[test]
fn clean_tags_preserves_duplicates() {
let input = vec!["rust".to_string(), " rust ".to_string(), "rust".to_string()];
let input = vec![
"rust".to_string(),
" rust ".to_string(),
"rust".to_string(),
];
assert_eq!(
clean_tags(&input),
vec!["rust".to_string(), "rust".to_string(), "rust".to_string()]