Compare commits

..

No commits in common. "e12e59461bf3b340afdf3b21e55f3d6ddc0cafa6" and "0242534274731abc1cade3c44d835a6b1f95e0da" have entirely different histories.

4 changed files with 22 additions and 45 deletions

View File

@ -42,7 +42,7 @@ hey -c 100 -n 100000 http://localhost:8080/
### Key Metrics to Watch ### Key Metrics to Watch
| Metric | Description | | Metric | Description |
| -------------------- | ---------------------------- | |--------|-------------|
| Requests/sec | Throughput | | Requests/sec | Throughput |
| Average latency | Mean response time | | Average latency | Mean response time |
| P99 latency | Tail latency | | P99 latency | Tail latency |
@ -52,7 +52,7 @@ hey -c 100 -n 100000 http://localhost:8080/
### Flame Graph Hotspots ### Flame Graph Hotspots
| Expected Hotspot | Code Location | Cause | | Expected Hotspot | Code Location | Cause |
| --------------------------------- | ---------------- | -------------------------------------------- | |------------------|---------------|-------|
| SSR rendering | Dioxus framework | Virtual DOM diff + render per request | | SSR rendering | Dioxus framework | Virtual DOM diff + render per request |
| `deadpool` connection acquisition | `src/db/mod.rs` | Connection pool contention under concurrency | | `deadpool` connection acquisition | `src/db/mod.rs` | Connection pool contention under concurrency |
| `moka` cache lookup | `src/cache.rs` | Cache hit/miss overhead | | `moka` cache lookup | `src/cache.rs` | Cache hit/miss overhead |
@ -64,7 +64,3 @@ hey -c 100 -n 100000 http://localhost:8080/
- `DB_POOL_SIZE` — increase if `deadpool` / `Semaphore` shows high in flame graph - `DB_POOL_SIZE` — increase if `deadpool` / `Semaphore` shows high in flame graph
- `SSR_CACHE_SECS` — increase to cache SSR output longer - `SSR_CACHE_SECS` — increase to cache SSR output longer
- `TOKIO_WORKER_THREADS` — explicitly set worker thread count - `TOKIO_WORKER_THREADS` — explicitly set worker thread count
## CI
https://git.rua.plus/api/v1/repos/xfy/yggdrasil/actions/tasks

View File

@ -176,7 +176,8 @@ mod tests {
#[test] #[test]
fn render_comment_link_data_uri_removed() { 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("click"));
assert!(!result.contains("data:")); assert!(!result.contains("data:"));
} }

View File

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

View File

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