You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- When `latevars` needs a helper function, define it in static scope (bind it; see `auspost.rsprod`) and reference via `//encoder.helper exec`
802
802
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
+
803
809
**Conditional Assignment Pattern**
804
810
805
811
Use an inline condition when performing simple conditional assignments:
@@ -898,6 +904,13 @@ Cache parameter guidelines:
898
904
- Set `limit=0` to disable caching
899
905
- Set `max` and `limit` high enough to avoid evictions when memory allows
900
906
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
+
901
914
902
915
**Persistent chain of segments for per-state DP**
903
916
@@ -913,6 +926,14 @@ encoding optimisers; see `pdf417.ps.src` (simplest variant) for the
913
926
canonical form including the `flatten` helper.
914
927
915
928
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
+
916
937
### Anti-patterns
917
938
918
939
- Creating variables (dictionary entries) in hot loops
@@ -1106,7 +1127,7 @@ create a hooks entries named like `qrcode.before`.
1106
1127
1107
1128
### Profiling Results
1108
1129
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.
1110
1131
1111
1132
1112
1133
## Testing
@@ -1301,7 +1322,8 @@ Outputs:
1301
1322
-`__pandoc/barcodewriter.pdf` - Complete PDF manual
1302
1323
-`__pandoc/barcodewriter.html` - Self-contained HTML documentation
1303
1324
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),
0 commit comments