1- # Optimization Journal
1+ # Optimization journal
22
33<!-- diataxis: explanation -->
44
@@ -31,7 +31,7 @@ of cloning avoids a deep copy of the entire PickleValue tree.
3131
3232** Impact:** ~ 1.8x faster encode path.
3333
34- ### 2. Bypass serde_json intermediate
34+ ### 2. bypass serde_json intermediate
3535
3636** Technique:** Added ` src/pyconv.rs ` for direct ` PickleValue ` to/from
3737` PyObject ` conversion, eliminating ` serde_json::Value ` as an intermediate
@@ -47,7 +47,7 @@ allocation and traversal.
4747
4848** Impact:** 2-3.5x faster across most categories.
4949
50- ### 3. Decode path tuning
50+ ### 3. decode path tuning
5151
5252** Technique:** Single-pass Dict decode, pre-allocated ` Vec::with_capacity() ` ,
5353set/frozenset move semantics (no ` Vec ` clone), ` StackItem ` removal, ` @ `
@@ -62,7 +62,7 @@ keys like `"title"`, `"description"`) skip all 15+ marker key comparisons.
6262
6363** Impact:** Codec competitive with CPython pickle decode.
6464
65- ### 4. Encode marker fast path
65+ ### 4. encode marker fast path
6666
6767** Technique:** Single-key dicts use direct key extraction plus match instead
6868of 15 sequential ` dict.get_item() ` calls. 2-4 key dicts use a single-pass
@@ -81,7 +81,7 @@ prefixed keys and matches on the first character after `@`.
8181
8282** Impact:** Reduced ` get_item() ` calls for ` @cls ` + ` @s ` from ~ 16 to 2.
8383
84- ### 5. Direct PyObject encoder
84+ ### 5. direct PyObject encoder
8585
8686** Technique:** ` pyconv.rs ` encode path writes pickle opcodes straight from
8787Python objects, bypassing the PickleValue tree allocation. Handles common
@@ -95,7 +95,7 @@ we eliminate the entire intermediate tree.
9595
9696** Impact:** Encode competitive with CPython C pickler.
9797
98- ### 6. Shared ZODB memo
98+ ### 6. shared ZODB memo
9999
100100** Technique:** Single Decoder instance processes both class and state pickles,
101101preserving memo entries across the boundary.
@@ -124,7 +124,7 @@ requests concurrently.
124124single-thread speedup, but significant throughput improvement in
125125multi-threaded deployments.
126126
127- ### 8. Single -pass PG decode
127+ ### 8. single -pass PG decode
128128
129129** Technique:** ` decode_zodb_record_for_pg() ` combines decode + persistent
130130reference extraction + null-byte sanitization in one function, eliminating two
@@ -141,7 +141,7 @@ two full traversals.
141141
142142## v1.3.0
143143
144- ### 9. Box Instance variant
144+ ### 9. box instance variant
145145
146146** Technique:** Changed ` Instance(InstanceData) ` to ` Instance(Box<InstanceData>) `
147147in the ` PickleValue ` enum.
@@ -164,7 +164,7 @@ utilization.
164164
165165## v1.3.1
166166
167- ### 10. Thin LTO + codegen-units=1
167+ ### 10. thin LTO + codegen-units=1
168168
169169** Technique:** Set ` lto = "thin" ` and ` codegen-units = 1 ` in the Cargo release
170170profile.
@@ -185,7 +185,7 @@ increase is modest and the performance gain is consistent.
185185
186186## v1.4.0
187187
188- ### 11. Direct pickle-to-JSON string path
188+ ### 11. direct pickle-to-JSON string path
189189
190190** Technique:** ` decode_zodb_record_for_pg_json() ` converts ZODB pickle records
191191entirely in Rust, producing a JSON string directly. The GIL is released for
@@ -204,7 +204,7 @@ allocation.
204204** Impact:** 1.3x faster full pipeline on real-world data, plus improved
205205multi-threaded throughput from GIL release.
206206
207- ## v1.5.0 -- Encode Performance Rounds 1-4
207+ ## v1.5.0 -- encode performance rounds 1-4
208208
209209### Round 1
210210
@@ -232,7 +232,7 @@ this replaces ~20 string comparisons with a single hash probe.
232232** Impact:** Measurable improvement across all encode benchmarks, especially
233233for integer-heavy and large-dict payloads.
234234
235- #### 13. Profile-Guided Optimization (PGO)
235+ #### 13. profile-guided optimization (PGO)
236236
237237** Technique:** Two-pass instrumented build. First pass collects execution
238238profiles using real FileStorage data (5 MB Wikipedia database, 1,692 records)
@@ -259,7 +259,7 @@ can exploit.
259259
260260### Round 2
261261
262- #### 14. Direct known-type encoding
262+ #### 14. direct known-type encoding
263263
264264** Technique:** For ` @dt ` , ` @date ` , ` @time ` , ` @td ` , ` @dec ` markers: write
265265pickle opcodes directly to the output buffer instead of allocating
@@ -279,7 +279,7 @@ sequence of buffer writes.
279279
280280** Impact:** special_types ** 9.2x faster** than Python pickle.
281281
282- #### 15. Thread -local buffer reuse
282+ #### 15. thread -local buffer reuse
283283
284284** Technique:** ` ENCODE_BUF ` thread-local ` Vec<u8> ` retains capacity across
285285calls. On each encode, the buffer is cleared (length reset to 0) but the
@@ -305,7 +305,7 @@ sharing), and the memory cost is bounded (one buffer per thread).
305305
306306### Round 3
307307
308- #### 16. Direct JSON string writer
308+ #### 16. direct JSON string writer
309309
310310** Technique:** ` json_writer.rs ` writes JSON tokens directly from the
311311` PickleValue ` AST to a ` String ` buffer. Fast-path string escaping (scan for
@@ -333,7 +333,7 @@ floats to strings without going through `format!()`, avoiding a temporary
333333
334334### Round 4
335335
336- #### 17. Class pickle cache
336+ #### 17. class pickle cache
337337
338338** Technique:** Thread-local cache per ` (module, name) ` pair. Linear search
339339over ~ 6 entries (faster than ` HashMap ` for small sets). First call builds and
0 commit comments