Skip to content

#13 Opt-in compatible map-method reuse for nested mappings - #296

Merged
sanelli merged 4 commits into
mainfrom
13-typemapidentifierwithmapmethodalgorithm-getstrategy-should-also-allow-to-get-compatible-methods-in-some-scenarios
Aug 1, 2026
Merged

#13 Opt-in compatible map-method reuse for nested mappings#296
sanelli merged 4 commits into
mainfrom
13-typemapidentifierwithmapmethodalgorithm-getstrategy-should-also-allow-to-get-compatible-methods-in-some-scenarios

Conversation

@sanelli

@sanelli sanelli commented Aug 1, 2026

Copy link
Copy Markdown
Owner

Summary

  • Add opt-in MappaSettings.CompatibleMapMethod so nested mappings can reuse methods whose parameter is a base/interface of the required source and whose return type is derived from the required target.
  • Wire TryGetCompatibleMethod / CompatibleMethodMapStrategy into TypeMapIdentifierWithMapMethodAlgorithm (after exact/relaxed, before polymorphic), with samples, AOT runner, docs, and tests.
  • Update the development workflow rule for internet proxy hygiene and requiring branches to start with the issue number.

Test plan

  • Generator unit/integration tests for compatible matching (enable/disable, interface source, context gate)
  • Sample + sample tests + AOT runner for CompatibleMapMethodMapper
  • .\Scripts\RunTestsAndReportCoverage.ps1 (2670 passed; line/method at baseline; branch 90.5% vs 90.6% baseline dilution from settings parse when is int false arm)

Closes #13

sanelli and others added 4 commits August 1, 2026 10:28
Introduce the opt-in MappaSettings.CompatibleMapMethod property (alpha.31) and document workflow rules for internet proxy hygiene and issue-numbered branch prefixes.

Co-authored-by: Cursor <cursoragent@cursor.com>
Wire opt-in compatible map-method matching (base/interface source, derived return), CompatibleMethodMapStrategy, and generator tests; bump to alpha.32.

Co-authored-by: Cursor <cursoragent@cursor.com>
Demonstrate opt-in compatible map-method reuse in samples with runtime and AOT coverage, and document the setting across attributes, tutorial, features, and algorithm.

Co-authored-by: Cursor <cursoragent@cursor.com>
Add unit tests for empty access-field prefix and MappaContext argument inclusion/omission so builder branch coverage is complete.

Co-authored-by: Cursor <cursoragent@cursor.com>
@github-actions

github-actions Bot commented Aug 1, 2026

Copy link
Copy Markdown

Code coverage

Compared against the latest published coverage history from the code coverage gist.

Metric Baseline PR Δ Trend
Line 98.4% 98.4% 0 =
Branch 90.6% 90.5% -0.1
Method 100% 100% 0 =

No coverage metric dropped by more than 1 percentage point(s) versus baseline.

Benchmarks

AutoMapper is the BenchmarkDotNet ratio baseline. Absolute values are mean time in nanoseconds and allocated bytes. Ratio columns are competitor / Mappa as a percentage (n/a when either side is missing or Mappa is zero).

Benchmark Automapper Mean (ns) Automapper Allocated (B) Mapster Mean (ns) Mapster Allocated (B) Mapperly Mean (ns) Mapperly Allocated (B) Mappa Mean (ns) Mappa Allocated (B) Automapper/Mappa Time Automapper/Mappa Alloc Mapperly/Mappa Time Mapperly/Mappa Alloc Mapster/Mappa Time Mapster/Mappa Alloc
ArrayToListBenchmark 72.43 32 80533.43 194456 7761.59 38456 7655.55 38456 0.9% 0.1% 101.4% 100% 1052% 505.7%
DictionaryBenchmark 140690 185221.12 91560 214364.16 11520 46018.56 13950 58316.8 1008.5% 317.6% 82.6% 78.9% 656.3% 367.6%
FastListToArrayBenchmark n/a n/a 83580 194426.88 7640 38420.48 7880 38420.48 n/a n/a 97% 100% 1060.7% 506.1%
IQueryableProjectionBenchmark 610900 31784.96 597300 31016.96 601400 32983.04 606100 32983.04 100.8% 96.4% 99.2% 100% 98.5% 94%
ListToArrayBenchmark n/a n/a 83626 194426.88 7847 38420.48 7544 38420.48 n/a n/a 104% 100% 1108.5% 506.1%
ListToHashSetBenchmark 425.2 5765.12 2344.2 5765.12 2603.6 5806.08 2678.9 5765.12 15.9% 100% 97.2% 100.7% 87.5% 100%
NestedDtoBenchmark 129256 225320.96 95887 227471.36 8355 38942.72 8012 38942.72 1613.3% 578.6% 104.3% 100% 1196.8% 584.1%

Benchmark trends (Mappa)

Lower is better. Compared against the latest published Mappa-only rows from MAPPA-BENCHMARK-HISTORY.md.

Benchmark Measure Baseline PR Δ Trend
ArrayToListBenchmark TIME_NS 6886.15 7655.55 +769.4
ArrayToListBenchmark ALLOC_B 38456 38456 0 =
DictionaryBenchmark TIME_NS 12660 13950 +1290
DictionaryBenchmark ALLOC_B 58316.8 58316.8 0 =
ListToArrayBenchmark TIME_NS 6414 7544 +1130
ListToArrayBenchmark ALLOC_B 38420.48 38420.48 0 =
FastListToArrayBenchmark TIME_NS 6585 7880 +1295
FastListToArrayBenchmark ALLOC_B 38420.48 38420.48 0 =
IQueryableProjectionBenchmark TIME_NS 608900 606100 -2800
IQueryableProjectionBenchmark ALLOC_B 32983.04 32983.04 0 =
NestedDtoBenchmark TIME_NS 6593 8012 +1419
NestedDtoBenchmark ALLOC_B 38942.72 38942.72 0 =
ListToHashSetBenchmark TIME_NS 2438.5 2678.9 +240.4
ListToHashSetBenchmark ALLOC_B 5765.12 5765.12 0 =

@sanelli
sanelli merged commit 194c1b6 into main Aug 1, 2026
1 check passed
@sanelli
sanelli deleted the 13-typemapidentifierwithmapmethodalgorithm-getstrategy-should-also-allow-to-get-compatible-methods-in-some-scenarios branch August 1, 2026 10:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[TypeMapIdentifierWithMapMethodAlgorithm] GetStrategy should also allow to get compatible methods in some scenarios.

1 participant