Skip to content

Commit 00fdbfc

Browse files
committed
Update CONTRIBUTING.md
1 parent 6007d55 commit 00fdbfc

1 file changed

Lines changed: 24 additions & 2 deletions

File tree

CONTRIBUTING.md

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -800,6 +800,12 @@ from the clone passed to gs1-cc.
800800
- Defer expensive computation to lazy init (first-run cost, cached thereafter)
801801
- When `latevars` needs a helper function, define it in static scope (bind it; see `auspost.rsprod`) and reference via `//encoder.helper exec`
802802

803+
**Hot scan techniques**
804+
805+
- Fuse related per-position outputs into one traversal, testing the shared per-position predicate once (build the mask layers together, testing data-vs-function module membership once per module; see `hanxin`, `qrcode`).
806+
- Skip a transform whose result is a known no-op rather than computing it (the identity mask yields an all-zero layer, so evaluate the unmasked symbol directly; see `hanxin`).
807+
- Classify positions in a hot scan by indexing a static string with a small per-position code, spilling to variables only on the rare matching branch (stem-corner detection in the region trace; see `renmatrix`).
808+
803809
**Conditional Assignment Pattern**
804810

805811
Use an inline condition when performing simple conditional assignments:
@@ -898,6 +904,13 @@ Cache parameter guidelines:
898904
- Set `limit=0` to disable caching
899905
- Set `max` and `limit` high enough to avoid evictions when memory allows
900906

907+
Shape what you cache into the exact form the inner loop consumes, so no per-call
908+
massaging is needed: the Reed-Solomon caches hold generator coefficients
909+
reversed and in the log domain with a sentinel for a zero coefficient,
910+
`readonly`, and a companion lazy-init anti-log table spanning two field periods
911+
resolves log-sums without a modulo, so that each RSEC inner-loop step is a
912+
single `get`, log-add, `get` and `xor`/`put`. See `rsecbinary`, `rsecprime`.
913+
901914

902915
**Persistent chain of segments for per-state DP**
903916

@@ -913,6 +926,14 @@ encoding optimisers; see `pdf417.ps.src` (simplest variant) for the
913926
canonical form including the `flatten` helper.
914927

915928

929+
**Collapse relaxation passes via precomputed closure**
930+
931+
When a per-state optimiser relaxes candidate costs to a fixed point, precompute
932+
the transitive closure of the transition tables so that a single relaxation pass
933+
per character reaches the fixed point rather than iterating to convergence. See
934+
`azteccode`, whose latch tables are transitively closed.
935+
936+
916937
### Anti-patterns
917938

918939
- Creating variables (dictionary entries) in hot loops
@@ -1106,7 +1127,7 @@ create a hooks entries named like `qrcode.before`.
11061127

11071128
### Profiling Results
11081129

1109-
Performance enhancements are welcome, but significant gains are hard won. Large 2D symbols have different bottlenecks: QR Code is mask evaluation bound; Data Matrix is RSEC bound (mitigated by FIFO caches). Aztec splits roughly evenly between input encoding and RSEC. PDF417 and MicroPDF417 are fast enough that no single phase dominates. See encoder source for attempted optimizations.
1130+
Performance enhancements are welcome, but significant gains are hard won. Large 2D symbols have different bottlenecks: QR Code and Han Xin are mask evaluation bound; Data Matrix is RSEC bound (mitigated by FIFO caches). Aztec splits roughly evenly between input encoding and RSEC. PDF417 and MicroPDF417 are fast enough that no single phase dominates. See encoder source for attempted optimizations.
11101131

11111132

11121133
## Testing
@@ -1301,7 +1322,8 @@ Outputs:
13011322
- `__pandoc/barcodewriter.pdf` - Complete PDF manual
13021323
- `__pandoc/barcodewriter.html` - Self-contained HTML documentation
13031324

1304-
The build requires Pandoc, the Haskell runtime and LaTeX.
1325+
The build requires Pandoc 3.x (the LaTeX template targets Pandoc 3.x output),
1326+
the Haskell runtime and LaTeX.
13051327

13061328

13071329
### Wiki Example Images

0 commit comments

Comments
 (0)