Skip to content

Add SbSmallMap for the profiler texture cache - #757

Draft
Dikluwe wants to merge 7 commits into
coin3d:masterfrom
Dikluwe:codex/maps/use/profiler-textures-small
Draft

Dikluwe wants to merge 7 commits into
coin3d:masterfrom
Dikluwe:codex/maps/use/profiler-textures-small

Conversation

@Dikluwe

@Dikluwe Dikluwe commented Sep 19, 2026

Copy link
Copy Markdown
Contributor

Summary

  • add a private SbSmallMap for trivial key/value pairs, using SbList's four inline entries before one contiguous spill allocation
  • define the type, invalidation, allocation-failure, and noexcept equality contracts and cover them with direct and differential tests
  • replace the profiler's six-entry texture std::map with SbSmallMap
  • verify that repeated visualizations reuse each cached texture while all six texture categories remain distinct

Measurements

Instrumentation of the real profiler path observed the fixed expected workload: six insertions, 18 lookups, maximum cardinality six.

A local Release benchmark reproducing six insertions, 18 lookups, one iteration, and cleanup measured these medians over five complete runs:

Container Lifecycle Steady lookup Allocations per lifecycle
SbSmallMap 73.87 ns 2.49 ns 1
std::map 188.43 ns 2.73 ns 6

The benchmark and instrumentation are intentionally kept outside this PR and are used only as local engineering evidence.

Stack

Depends on #756. Until that PR is merged, GitHub also shows its two SbList commits in this diff. This PR intentionally introduces the private container together with its first measured consumer instead of landing unused infrastructure.

Testing

  • complete Release build
  • CTest: 8/8 passed
  • direct spill-allocation failure and recovery coverage
  • ASan run completed without an error attributable to this change
  • UBSan repeated the pre-existing SoPath/SoFullPath downcast finding outside this diff

This branch has not been deployed

No deployments
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.

1 participant