Skip to content

Commit c4edec9

Browse files
committed
Add redundant action property to optimization plan
1 parent a4a0f7c commit c4edec9

File tree

1 file changed

+32
-6
lines changed

1 file changed

+32
-6
lines changed

json-optimization-plan.md

Lines changed: 32 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,29 @@
1212

1313
## Optimization Approaches
1414

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+
1538
### 1. Short Property Names (~80 KB savings, ~17% reduction)
1639

1740
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.
103126

104127
| Phase | Approach | Savings | Cumulative Size | Complexity |
105128
|-------|----------|---------|-----------------|------------|
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.**
110136

111-
**Phase 1 alone gets you 17% reduction with minimal code changes.**
137+
**Phases 0+1 get you ~18% reduction with minimal code changes.**
112138

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).**
114140

115141
---
116142

0 commit comments

Comments
 (0)