@peaske7/readit 0.1.7 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +0 -3
- package/biome.json +1 -1
- package/bun.lock +43 -185
- package/docs/perf-baseline.md +75 -0
- package/docs/superpowers/plans/2026-03-26-surgical-pruning.md +1176 -0
- package/e2e/perf/add-comment.spec.ts +118 -0
- package/e2e/perf/fixtures/generate.ts +331 -0
- package/e2e/perf/initial-load.spec.ts +49 -0
- package/e2e/perf/perf.setup.ts +23 -0
- package/e2e/perf/perf.teardown.ts +9 -0
- package/e2e/perf/scroll.spec.ts +39 -0
- package/e2e/perf/tab-switch.spec.ts +69 -0
- package/e2e/perf/text-selection.spec.ts +119 -0
- package/e2e/perf/utils/metrics.ts +286 -0
- package/e2e/perf/utils/perf-cli.ts +86 -0
- package/package.json +9 -18
- package/playwright.config.ts +12 -0
- package/src/App.tsx +133 -178
- package/src/{cli/index.ts → cli.ts} +211 -107
- package/src/components/ActionsMenu.tsx +6 -27
- package/src/components/DocumentViewer/DocumentViewer.tsx +78 -105
- package/src/components/DocumentViewer/MermaidDiagram.tsx +6 -7
- package/src/components/Header.tsx +9 -20
- package/src/components/InlineEditor.tsx +5 -5
- package/src/components/MarginNote.tsx +71 -93
- package/src/components/MarginNotes.tsx +7 -34
- package/src/components/RawModal.tsx +9 -8
- package/src/components/ReanchorConfirm.tsx +2 -2
- package/src/components/SettingsModal.tsx +11 -89
- package/src/components/TabBar.tsx +4 -4
- package/src/components/TableOfContents.tsx +5 -5
- package/src/components/comments/CommentInput.tsx +7 -35
- package/src/components/comments/CommentListItem.tsx +9 -11
- package/src/components/comments/CommentManager.tsx +53 -37
- package/src/components/comments/CommentNav.tsx +14 -14
- package/src/components/ui/ActionLink.tsx +14 -18
- package/src/components/ui/Button.tsx +42 -43
- package/src/components/ui/Dialog.tsx +73 -113
- package/src/components/ui/DropdownMenu.tsx +113 -69
- package/src/components/ui/Text.tsx +30 -37
- package/src/contexts/CommentContext.tsx +75 -106
- package/src/contexts/LocaleContext.tsx +45 -4
- package/src/contexts/PositionsContext.tsx +16 -0
- package/src/contexts/SettingsContext.tsx +133 -0
- package/src/hooks/useClickOutside.ts +0 -4
- package/src/hooks/useCommentNavigation.ts +6 -29
- package/src/hooks/useComments.ts +6 -18
- package/src/hooks/useDocument.ts +35 -34
- package/src/hooks/useHeadings.test.ts +8 -50
- package/src/hooks/useHeadings.ts +5 -88
- package/src/hooks/useScrollSpy.ts +10 -14
- package/src/hooks/useTextSelection.ts +1 -38
- package/src/lib/__fixtures__/bench-data.ts +1 -41
- package/src/lib/anchor.bench.ts +57 -67
- package/src/lib/anchor.test.ts +5 -1
- package/src/lib/anchor.ts +13 -93
- package/src/lib/comment-storage.test.ts +4 -4
- package/src/lib/comment-storage.ts +2 -46
- package/src/lib/export.ts +7 -13
- package/src/lib/highlight/core.test.ts +1 -1
- package/src/lib/highlight/dom.ts +5 -68
- package/src/lib/highlight/highlighter.ts +102 -262
- package/src/lib/highlight/resolver.ts +112 -0
- package/src/lib/highlight/types.ts +0 -35
- package/src/lib/highlight/worker.ts +45 -0
- package/src/lib/i18n/en.ts +1 -50
- package/src/lib/i18n/ja.ts +1 -50
- package/src/lib/i18n/types.ts +1 -49
- package/src/lib/margin-layout.ts +5 -27
- package/src/lib/positions.ts +150 -0
- package/src/lib/utils.ts +2 -19
- package/src/schema.ts +81 -0
- package/src/{server/index.ts → server.ts} +111 -81
- package/src/{store/index.ts → store.ts} +14 -46
- package/vite.config.ts +8 -0
- package/src/components/DocumentViewer/IframeContainer.tsx +0 -251
- package/src/components/DocumentViewer/InlineCode.tsx +0 -60
- package/src/components/DocumentViewer/index.ts +0 -1
- package/src/components/FloatingTOC.tsx +0 -61
- package/src/components/ShortcutCapture.tsx +0 -48
- package/src/components/ShortcutList.tsx +0 -198
- package/src/components/comments/CommentMinimap.tsx +0 -62
- package/src/components/ui/ActionBar.tsx +0 -16
- package/src/components/ui/SeparatorDot.tsx +0 -9
- package/src/contexts/LayoutContext.tsx +0 -88
- package/src/hooks/useClipboard.ts +0 -82
- package/src/hooks/useEditorScheme.ts +0 -51
- package/src/hooks/useFontPreference.ts +0 -59
- package/src/hooks/useKeybindings.ts +0 -108
- package/src/hooks/useKeyboardShortcuts.ts +0 -63
- package/src/hooks/useLayoutMode.ts +0 -44
- package/src/hooks/useLocalePreference.ts +0 -42
- package/src/hooks/useReanchorMode.ts +0 -33
- package/src/hooks/useScrollMetrics.ts +0 -56
- package/src/hooks/useThemePreference.ts +0 -66
- package/src/lib/comment-storage.bench.ts +0 -63
- package/src/lib/context.bench.ts +0 -41
- package/src/lib/context.test.ts +0 -224
- package/src/lib/context.ts +0 -193
- package/src/lib/editor-links.ts +0 -59
- package/src/lib/export.bench.ts +0 -35
- package/src/lib/highlight/colors.ts +0 -37
- package/src/lib/highlight/core.ts +0 -54
- package/src/lib/highlight/index.ts +0 -23
- package/src/lib/highlight/script-builder.ts +0 -485
- package/src/lib/html-processor.test.tsx +0 -170
- package/src/lib/html-processor.tsx +0 -95
- package/src/lib/i18n/completeness.test.ts +0 -51
- package/src/lib/i18n/translations.test.ts +0 -39
- package/src/lib/layout-constants.ts +0 -12
- package/src/lib/margin-layout.bench.ts +0 -28
- package/src/lib/scroll.test.ts +0 -118
- package/src/lib/scroll.ts +0 -47
- package/src/lib/shortcut-registry.test.ts +0 -173
- package/src/lib/shortcut-registry.ts +0 -209
- package/src/lib/utils.test.ts +0 -110
- package/src/store/index.test.ts +0 -242
- package/src/types/index.ts +0 -127
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
# Performance Baseline
|
|
2
|
+
|
|
3
|
+
Captured: 2026-03-27
|
|
4
|
+
Machine: Darwin 25.3.0 (Apple Silicon)
|
|
5
|
+
Runtime: Bun
|
|
6
|
+
Build: production (`bun run build`)
|
|
7
|
+
|
|
8
|
+
## E2E Metrics (Playwright, Chromium)
|
|
9
|
+
|
|
10
|
+
### Initial Load
|
|
11
|
+
|
|
12
|
+
| Tier | Lines | Comments | FCP | DCL | All Highlights Painted | Highlights Found |
|
|
13
|
+
|------|-------|----------|-----|-----|------------------------|------------------|
|
|
14
|
+
| medium | 1,000 | 100 | 112ms | 74ms | **886ms** | 100 |
|
|
15
|
+
| large | 3,000 | 200 | 368ms | 22ms | **3,247ms** | 193 |
|
|
16
|
+
|
|
17
|
+
### Interactions
|
|
18
|
+
|
|
19
|
+
| Metric | Tier | Result |
|
|
20
|
+
|--------|------|--------|
|
|
21
|
+
| Add comment (time to new highlight) | medium | **98ms** |
|
|
22
|
+
| Text selection (median of 5) | medium | **9ms** |
|
|
23
|
+
| Tab switch (medium → medium-b, 100 → 100 comments) | medium | **414ms** |
|
|
24
|
+
|
|
25
|
+
### Scroll Performance
|
|
26
|
+
|
|
27
|
+
| Tier | Total Scroll Time | Long Tasks (>50ms) | P50 | P95 | P99 |
|
|
28
|
+
|------|-------------------|-------------------|-----|-----|-----|
|
|
29
|
+
| medium (1000 lines, 100 comments) | 8,953ms | 0 | 0ms | 0ms | 0ms |
|
|
30
|
+
| large (3000 lines, 200 comments) | 25,912ms | 3 | 106ms | 121ms | 121ms |
|
|
31
|
+
|
|
32
|
+
## Bundle Size
|
|
33
|
+
|
|
34
|
+
| Asset | Raw | Gzipped |
|
|
35
|
+
|-------|-----|---------|
|
|
36
|
+
| Main JS (index-*.js) | 667 KB | 206 KB |
|
|
37
|
+
| Total dist/assets/ | 6.5 MB | — |
|
|
38
|
+
| CSS (index-*.css) | 45 KB | — |
|
|
39
|
+
| CLI (cli.js) | 51 KB | — |
|
|
40
|
+
|
|
41
|
+
### Top chunks by size
|
|
42
|
+
|
|
43
|
+
| Chunk | Size | Purpose |
|
|
44
|
+
|-------|------|---------|
|
|
45
|
+
| index-DCIQ7W07.js | 652 KB | Main app bundle |
|
|
46
|
+
| chunk-XZSTWKYB.js | 426 KB | Mermaid core |
|
|
47
|
+
| cytoscape.esm.js | 424 KB | Mermaid dependency |
|
|
48
|
+
| katex.js | 250 KB | Math rendering (mermaid) |
|
|
49
|
+
| prism.js | 146 KB | Syntax highlighter |
|
|
50
|
+
| architectureDiagram.js | 143 KB | Mermaid architecture |
|
|
51
|
+
| chunk-7R4GIKGN.js | 124 KB | Mermaid support |
|
|
52
|
+
| esm.js | 112 KB | Mermaid support |
|
|
53
|
+
|
|
54
|
+
## Vitest Bench (Server-side Operations)
|
|
55
|
+
|
|
56
|
+
> Run with: `bun run bench`
|
|
57
|
+
|
|
58
|
+
Results populated after running benchmarks. See `src/lib/*.bench.ts`.
|
|
59
|
+
|
|
60
|
+
## Key Bottlenecks (from analysis)
|
|
61
|
+
|
|
62
|
+
1. **All Highlights Painted** is the critical metric: 886ms (medium), 3,247ms (large)
|
|
63
|
+
- Dominated by: react-markdown parse → React reconcile → rAF → TreeWalker → Worker → TreeWalker → DOM surgery
|
|
64
|
+
2. **Tab switch** (414ms) is highlight re-application on a new document
|
|
65
|
+
3. **Large doc scroll** shows 3 long tasks (106-121ms) — likely margin note position recalculation or highlight intersection
|
|
66
|
+
4. **Bundle**: 667KB main + lazy mermaid (1MB+) means slow cold loads on constrained networks
|
|
67
|
+
|
|
68
|
+
## Optimization Targets
|
|
69
|
+
|
|
70
|
+
| Change | Metric to Watch | Current | Goal |
|
|
71
|
+
|--------|----------------|---------|------|
|
|
72
|
+
| Server-side MD rendering | FCP, All Highlights Painted | 886ms / 3,247ms | <100ms / <500ms |
|
|
73
|
+
| CSS Custom Highlight API | All Highlights Painted, Add Comment | 886ms / 98ms | <100ms / <20ms |
|
|
74
|
+
| Eliminate SPA waterfall | FCP | 112ms / 368ms | <30ms |
|
|
75
|
+
| Drop heavy client deps | Bundle size (main JS) | 667KB | <50KB |
|