-
Notifications
You must be signed in to change notification settings - Fork 3
Comparing changes
Open a pull request
base repository: mapcode-foundation/mapcode-cpp
base: v2.5.6
head repository: mapcode-foundation/mapcode-cpp
compare: master
- 19 commits
- 9 files changed
- 2 contributors
Commits on May 28, 2026
-
Fix critical and major code review issues
- Replace memcmp-based NaN/Inf detection with isnan()/isinf() from <math.h> (portable, correct for all NaN bit patterns, and now checks latDeg for Inf too) - Fix off-by-one in encodeLatLonToSelectedMapcode: > should be >= for index bound - Remove always-false ASSERT after *s=0 in encodeExtension - Fix convertFromAbjad/convertToAbjad to null-check strchr return before arithmetic - Allow TERRITORY_NONE/TERRITORY_UNKNOWN in encodeLatLonToSingleMapcode per docs - Fix convertUtf16ToUtf8 to return start pointer instead of post-null end pointer - Explicitly initialize GLOBAL_MAKEISO_PTR (was accidentally correct via NULL) - Replace sprintf with snprintf in convertToRoman (mapcode_legacy.c) - Change UWORD from unsigned short int to uint16_t; add #include <stdint.h> - Replace magic constant 128 with MAX_MAPCODE_RESULT_ASCII_LEN in encoderEngine - Add regression tests for all fixed bugs in testBugFixes() Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Configuration menu - View commit details
-
Copy full SHA for 47e0d32 - Browse repository at this point
Copy the full SHA 47e0d32View commit details -
Configuration menu - View commit details
-
Copy full SHA for ea028ff - Browse repository at this point
Copy the full SHA ea028ffView commit details -
Fix critical and major code review issues
- Replace memcmp-based NaN/Inf detection with isnan()/isinf() from <math.h> (portable, correct for all NaN bit patterns, and now checks latDeg for Inf too) - Fix off-by-one in encodeLatLonToSelectedMapcode: > should be >= for index bound - Remove always-false ASSERT after *s=0 in encodeExtension - Fix convertFromAbjad/convertToAbjad to null-check strchr return before arithmetic - Allow TERRITORY_NONE/TERRITORY_UNKNOWN in encodeLatLonToSingleMapcode per docs - Fix convertUtf16ToUtf8 to return start pointer instead of post-null end pointer - Explicitly initialize GLOBAL_MAKEISO_PTR (was accidentally correct via NULL) - Replace sprintf with snprintf in convertToRoman (mapcode_legacy.c) - Change UWORD from unsigned short int to uint16_t; add #include <stdint.h> - Replace magic constant 128 with MAX_MAPCODE_RESULT_ASCII_LEN in encoderEngine - Add regression tests for all fixed bugs in testBugFixes() Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Configuration menu - View commit details
-
Copy full SHA for a21ef29 - Browse repository at this point
Copy the full SHA a21ef29View commit details -
Configuration menu - View commit details
-
Copy full SHA for 794e31f - Browse repository at this point
Copy the full SHA 794e31fView commit details -
docs: design spec for mapcodelib speed optimization
Two-phase plan (A: local hot-path cleanups; B: precomputed companion tables) targeting 20-50% wall-time reduction on `time ./unittest` at -O3, preserving bit-exact output, strict portable C99/C11, and no runtime/heap growth. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Configuration menu - View commit details
-
Copy full SHA for 740bfec - Browse repository at this point
Copy the full SHA 740bfecView commit details -
docs: implementation plan for mapcodelib speed optimization
Step-by-step plan for Tasks 1-10 (baseline → A1-A5 → B3-B5 → results), each with explicit file/line targets, code blocks, expected outputs, and per-step commits. Also fixes a small inaccuracy in the spec: RECORD_CODEX stores the computed coDex value (10*(c/5)+(c%5+1)), not the raw flags & 31. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Configuration menu - View commit details
-
Copy full SHA for 9813f71 - Browse repository at this point
Copy the full SHA 9813f71View commit details -
chore: pin perf baseline for feat/optimize
Measured `time ./unittest` on -O3 build (best of 3 runs): user time = T0 = 114.13s All subsequent perf commits on this branch quote their best user time and the cumulative delta vs. this baseline. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Configuration menu - View commit details
-
Copy full SHA for f1cb736 - Browse repository at this point
Copy the full SHA f1cb736View commit details -
perf: A1 — cache flags per loop iteration in hot paths
In encoderEngine and decoderEngine inner loops, read TERRITORY_BOUNDARIES[i].flags once per iteration into a const local and extract bit fields from it, instead of using flag-extraction macros that each re-dereference the same memory. Same change in firstNamelessRecord and countNamelessRecords. Bit-exact: macros stay defined and used in cold paths; only the inner loop body call sites were rewritten to local reads. time ./unittest (best of 3, user): baseline (T0) = 114.13s after A1 (T2) = 111.78s delta = 2.06% cumulative Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>Configuration menu - View commit details
-
Copy full SHA for 430bbba - Browse repository at this point
Copy the full SHA 430bbbaView commit details -
perf: A2 — reorder fitsInsideBoundaries to test longitude first
Most territory rectangles are narrower in longitude than in latitude relative to their bounding ranges, so testing longitude first short- circuits faster on the typical reject case. time ./unittest (best of 3, user): baseline = 114.13s after A2 = 121.10s delta = -6.11% cumulative (regression vs baseline) Note: result is slower than A1 (T2=112.21s); the lon-first ordering did not yield a speedup on this benchmark — likely because isInRange carries more overhead than the simple comparison it replaces. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>Configuration menu - View commit details
-
Copy full SHA for b9b3f2c - Browse repository at this point
Copy the full SHA b9b3f2cView commit details -
revert: A2 — reorder fitsInsideBoundaries (caused regression)
Reverts b9b3f2c. isInRange() wraps longitude and has higher overhead than simple comparisons; testing it first regressed user time by ~7.9s vs A1 baseline. Reverting to lat-first ordering. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Configuration menu - View commit details
-
Copy full SHA for 5246c79 - Browse repository at this point
Copy the full SHA 5246c79View commit details -
perf: A3 — length-tracked result assembly in encoderEngine
strcpy + strcat + strcat each re-scans the destination from the start to find the null terminator. Replace with explicit strlen on each source plus a single memcpy to copy result (including NUL). Output bytes are unchanged. time ./unittest (best of 3, user): baseline = 114.13s after A3 = 113.19s delta = 0.82% cumulative Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>Configuration menu - View commit details
-
Copy full SHA for 1b01b82 - Browse repository at this point
Copy the full SHA 1b01b82View commit details -
perf: A4 — single division per iteration in encodeBase31
Compute quotient once, derive remainder via subtraction so the loop has one division-class op per character rather than two. time ./unittest (best of 3, user): baseline = 114.13s after A4 = 114.35s delta = -0.19% cumulative (within noise floor) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>Configuration menu - View commit details
-
Copy full SHA for 753c337 - Browse repository at this point
Copy the full SHA 753c337View commit details -
perf: B1+B2+B3 — add precomputed companion tables and one-time init
Static tables RECORD_CODEX / RECORD_REC_TYPE / RECORD_KIND / RECORD_HEADER_LETTER / RECORD_SMART_DIV precomputed once from TERRITORY_BOUNDARIES.flags. Per-territory TERRITORY_FIRST_NAMELESS / TERRITORY_NAMELESS_COUNT replace linear nameless scans later. This commit only defines the tables and calls initCompanionTables at the top of encodeLatLonToMapcodes_internal and decoderEngine. Hot loops still use the existing macros; the switch happens in B4. Memory footprint: ~74 KB of additional static data (.bss). time ./unittest (best of 3, user): baseline = 114.13s after B3 = 109.99s delta = -3.6% cumulative Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>Configuration menu - View commit details
-
Copy full SHA for 554af29 - Browse repository at this point
Copy the full SHA 554af29View commit details -
perf: B4 — hot loops read from precomputed companion tables
Replace per-iteration mask/shift extractions in encoderEngine, decoderEngine, firstNamelessRecord, countNamelessRecords with direct reads from RECORD_KIND / RECORD_CODEX / RECORD_REC_TYPE / RECORD_HEADER_LETTER. The companion tables are byte-sized so each field is a single byte load with friendlier cache behavior than re-deriving from the 4-byte flags field each iteration. Inner j-loops in decoderEngine also switch to RECORD_KIND[j] & KIND_BIT_RESTRICTED instead of the IS_RESTRICTED(j) macro. Values are derived from the same macros they replace (see B3 init); output is bit-exact. time ./unittest (best of 3, user): baseline = 114.13s after B4 = 99.40s delta = -13.1% cumulative Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>Configuration menu - View commit details
-
Copy full SHA for 3416f87 - Browse repository at this point
Copy the full SHA 3416f87View commit details -
perf: B5 — DEBUG-build sanity check for companion tables
Under -DDEBUG, initCompanionTables asserts that every precomputed value matches the macro-derived one. Free correctness guard during development; zero cost in release. Verified: both -O3 and -O0 -DDEBUG builds pass the unit suite. time ./unittest -O3 (best of 3, user): baseline = 114.13s after B5 = 99.73s delta = -12.6% cumulative Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>Configuration menu - View commit details
-
Copy full SHA for 2cdf52b - Browse repository at this point
Copy the full SHA 2cdf52bView commit details -
docs: record final perf results for feat/optimize branch
Appends results table to design spec. Final speedup: ~12.6% on `time ./unittest` at -O3. Target was 20-50%; achieved 12.6%. Primary driver: B4 companion-table hot-loop reads. A2 reverted (regression), A4/A5 no-ops at -O3. Binary size delta: +2240 bytes. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Configuration menu - View commit details
-
Copy full SHA for 9f99fa8 - Browse repository at this point
Copy the full SHA 9f99fa8View commit details -
docs: add perf results table to docs/superpowers
Per-commit timing table for feat/optimize branch with notes on why each optimization landed, regressed, or was a no-op. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Configuration menu - View commit details
-
Copy full SHA for d5778ab - Browse repository at this point
Copy the full SHA d5778abView commit details -
Configuration menu - View commit details
-
Copy full SHA for 400c405 - Browse repository at this point
Copy the full SHA 400c405View commit details -
Configuration menu - View commit details
-
Copy full SHA for 85b4d82 - Browse repository at this point
Copy the full SHA 85b4d82View commit details
This comparison is taking too long to generate.
Unfortunately it looks like we can’t render this comparison for you right now. It might be too big, or there might be something weird with your repository.
You can try running this command locally to see the comparison on your machine:
git diff v2.5.6...master