|
12 | 12 |
|
13 | 13 | ## Optimization Approaches |
14 | 14 |
|
| 15 | +### 0. Strip Redundant `action` Property (~2 KB savings) |
| 16 | + |
| 17 | +The `action` property in each event action object duplicates information already present as the object's key: |
| 18 | + |
| 19 | +```json |
| 20 | +{ |
| 21 | + "issues": { |
| 22 | + "opened": { // <-- action name is already the key |
| 23 | + "action": "opened", // <-- redundant, can be stripped |
| 24 | + "bodyParameters": [...] |
| 25 | + } |
| 26 | + } |
| 27 | +} |
| 28 | +``` |
| 29 | + |
| 30 | +| Property | Occurrences | Bytes per occurrence | Savings | |
| 31 | +|----------|-------------|---------------------|---------| |
| 32 | +| `action` | 141 | ~15 bytes | ~2 KB | |
| 33 | + |
| 34 | +**Complexity:** Very low - add `action` to `EVENT_ACTION_FIELDS` strip list |
| 35 | + |
| 36 | +--- |
| 37 | + |
15 | 38 | ### 1. Short Property Names (~80 KB savings, ~17% reduction) |
16 | 39 |
|
17 | 40 | Replace verbose property names with single-character keys in the minified output. |
@@ -103,14 +126,17 @@ Example: The "user" object structure appears ~122 times with identical fields. |
103 | 126 |
|
104 | 127 | | Phase | Approach | Savings | Cumulative Size | Complexity | |
105 | 128 | |-------|----------|---------|-----------------|------------| |
106 | | -| 1 | Short property names | 80 KB | 384 KB | Low | |
107 | | -| 2 | Array-based structure | 79 KB | 305 KB | Medium | |
108 | | -| 3 | String interning | 40 KB | 265 KB | High | |
109 | | -| 4 | Subtree deduplication | 30-50 KB | 220-235 KB | High | |
| 129 | +| 0 | Strip redundant `action` | 2 KB | 462 KB | Very Low | |
| 130 | +| 1 | Short property names | 80 KB | 382 KB | Low | |
| 131 | +| 2 | Array-based structure | 79 KB | 303 KB | Medium | |
| 132 | +| 3 | String interning | 40 KB | 263 KB | High | |
| 133 | +| 4 | Subtree deduplication | 30-50 KB | 218-233 KB | High | |
| 134 | + |
| 135 | +**Phase 0 is a quick win - just add `action` to the existing strip list.** |
110 | 136 |
|
111 | | -**Phase 1 alone gets you 17% reduction with minimal code changes.** |
| 137 | +**Phases 0+1 get you ~18% reduction with minimal code changes.** |
112 | 138 |
|
113 | | -**Phases 1+2 combined get you ~34% reduction (464 KB → 305 KB).** |
| 139 | +**Phases 0+1+2 combined get you ~35% reduction (464 KB → 303 KB).** |
114 | 140 |
|
115 | 141 | --- |
116 | 142 |
|
|
0 commit comments