Skip to content

Comments

Replace TinyMap with std::unordered_map in Differentiator#55680

Open
sammy-SC wants to merge 1 commit intofacebook:mainfrom
sammy-SC:export-D90346356
Open

Replace TinyMap with std::unordered_map in Differentiator#55680
sammy-SC wants to merge 1 commit intofacebook:mainfrom
sammy-SC:export-D90346356

Conversation

@sammy-SC
Copy link
Contributor

Summary:
Replace TinyMap<Tag, X> with std::unordered_map<Tag, X>. There is no detectable regression in performance and code is simpler, let's remove TinyMap.

Summary

Benchmark Before (med) After (med) Change
Animated - render 100 views 2,272,119 ns 2,216,896 ns -2.4% (improvement)
Animated - render 100 animated views (no animations) 5,299,108 ns 5,260,190 ns -0.7% (improvement)
View - render 100 uncollapsable views 2,716,535 ns 2,698,891 ns -0.6% (improvement)
RSD vs RN: 100 nested View 2,027,791 ns 2,031,092 ns +0.2% (within noise)
console.createTask - Rendering 1000 views 140,085,232 ns 139,887,330 ns -0.1% (no change)

Differential Revision: D90346356

@meta-cla meta-cla bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Feb 23, 2026
@meta-codesync
Copy link

meta-codesync bot commented Feb 23, 2026

@sammy-SC has exported this pull request. If you are a Meta employee, you can view the originating Diff in D90346356.

sammy-SC added a commit to sammy-SC/react-native that referenced this pull request Feb 23, 2026
…5680)

Summary:

Replace TinyMap<Tag, X> with std::unordered_map<Tag, X>. There is no detectable regression in performance and code is simpler, let's remove TinyMap.

```
┌────────────────────────────┬──────────────────┬───────────────────────────────────┬───────────────┐
│         Benchmark          │ TinyMap (before) │ unordered_map + ctor size (after) │    Change     │
├────────────────────────────┼──────────────────┼───────────────────────────────────┼───────────────┤
│ 100 uncollapsable views    │ 1,499,917 ns     │ 1,343,333 ns                      │ -10.4%        │
├────────────────────────────┼──────────────────┼───────────────────────────────────┼───────────────┤
│ 1000 uncollapsable views   │ 52,148,021 ns    │ 44,131,792 ns                     │ -15.4%        │
├────────────────────────────┼──────────────────┼───────────────────────────────────┼───────────────┤
│ 100 views large props      │ 5,131,292 ns     │ 4,529,937 ns                      │ -11.7%        │
├────────────────────────────┼──────────────────┼───────────────────────────────────┼───────────────┤
│ 1000 views large props     │ 82,706,813 ns    │ 84,334,167 ns                     │ +2.0% (noise) │
├────────────────────────────┼──────────────────┼───────────────────────────────────┼───────────────┤
│ 1500 views large props     │ 61,470,542 ns    │ 62,976,646 ns                     │ +2.5% (noise) │
├────────────────────────────┼──────────────────┼───────────────────────────────────┼───────────────┤
│ deep (depth=5, breadth=4)  │ 32,672,583 ns    │ 30,700,542 ns                     │ -6.0%         │
├────────────────────────────┼──────────────────┼───────────────────────────────────┼───────────────┤
│ deep (depth=7, breadth=3)  │ 78,523,542 ns    │ 74,121,729 ns                     │ -5.6%         │
├────────────────────────────┼──────────────────┼───────────────────────────────────┼───────────────┤
│ deep (depth=10, breadth=2) │ 48,328,562 ns    │ 45,702,188 ns                     │ -5.4%         │
└────────────────────────────┴──────────────────┴───────────────────────────────────┴───────────────┘
```

Reviewed By: NickGerleman

Differential Revision: D90346356
sammy-SC added a commit to sammy-SC/react-native that referenced this pull request Feb 23, 2026
…5680)

Summary:

Replace TinyMap<Tag, X> with std::unordered_map<Tag, X>. There is no detectable regression in performance and code is simpler, let's remove TinyMap.

```
┌────────────────────────────┬──────────────────┬───────────────────────────────────┬───────────────┐
│         Benchmark          │ TinyMap (before) │ unordered_map + ctor size (after) │    Change     │
├────────────────────────────┼──────────────────┼───────────────────────────────────┼───────────────┤
│ 100 uncollapsable views    │ 1,499,917 ns     │ 1,343,333 ns                      │ -10.4%        │
├────────────────────────────┼──────────────────┼───────────────────────────────────┼───────────────┤
│ 1000 uncollapsable views   │ 52,148,021 ns    │ 44,131,792 ns                     │ -15.4%        │
├────────────────────────────┼──────────────────┼───────────────────────────────────┼───────────────┤
│ 100 views large props      │ 5,131,292 ns     │ 4,529,937 ns                      │ -11.7%        │
├────────────────────────────┼──────────────────┼───────────────────────────────────┼───────────────┤
│ 1000 views large props     │ 82,706,813 ns    │ 84,334,167 ns                     │ +2.0% (noise) │
├────────────────────────────┼──────────────────┼───────────────────────────────────┼───────────────┤
│ 1500 views large props     │ 61,470,542 ns    │ 62,976,646 ns                     │ +2.5% (noise) │
├────────────────────────────┼──────────────────┼───────────────────────────────────┼───────────────┤
│ deep (depth=5, breadth=4)  │ 32,672,583 ns    │ 30,700,542 ns                     │ -6.0%         │
├────────────────────────────┼──────────────────┼───────────────────────────────────┼───────────────┤
│ deep (depth=7, breadth=3)  │ 78,523,542 ns    │ 74,121,729 ns                     │ -5.6%         │
├────────────────────────────┼──────────────────┼───────────────────────────────────┼───────────────┤
│ deep (depth=10, breadth=2) │ 48,328,562 ns    │ 45,702,188 ns                     │ -5.4%         │
└────────────────────────────┴──────────────────┴───────────────────────────────────┴───────────────┘
```

Reviewed By: NickGerleman

Differential Revision: D90346356
…5680)

Summary:

changelog: [internal]

Replace TinyMap<Tag, X> with std::unordered_map<Tag, X>. There is no detectable regression in performance and code is simpler, let's remove TinyMap.

```
┌────────────────────────────┬──────────────────┬───────────────────────────────────┬───────────────┐
│         Benchmark          │ TinyMap (before) │ unordered_map + ctor size (after) │    Change     │
├────────────────────────────┼──────────────────┼───────────────────────────────────┼───────────────┤
│ 100 uncollapsable views    │ 1,499,917 ns     │ 1,343,333 ns                      │ -10.4%        │
├────────────────────────────┼──────────────────┼───────────────────────────────────┼───────────────┤
│ 1000 uncollapsable views   │ 52,148,021 ns    │ 44,131,792 ns                     │ -15.4%        │
├────────────────────────────┼──────────────────┼───────────────────────────────────┼───────────────┤
│ 100 views large props      │ 5,131,292 ns     │ 4,529,937 ns                      │ -11.7%        │
├────────────────────────────┼──────────────────┼───────────────────────────────────┼───────────────┤
│ 1000 views large props     │ 82,706,813 ns    │ 84,334,167 ns                     │ +2.0% (noise) │
├────────────────────────────┼──────────────────┼───────────────────────────────────┼───────────────┤
│ 1500 views large props     │ 61,470,542 ns    │ 62,976,646 ns                     │ +2.5% (noise) │
├────────────────────────────┼──────────────────┼───────────────────────────────────┼───────────────┤
│ deep (depth=5, breadth=4)  │ 32,672,583 ns    │ 30,700,542 ns                     │ -6.0%         │
├────────────────────────────┼──────────────────┼───────────────────────────────────┼───────────────┤
│ deep (depth=7, breadth=3)  │ 78,523,542 ns    │ 74,121,729 ns                     │ -5.6%         │
├────────────────────────────┼──────────────────┼───────────────────────────────────┼───────────────┤
│ deep (depth=10, breadth=2) │ 48,328,562 ns    │ 45,702,188 ns                     │ -5.4%         │
└────────────────────────────┴──────────────────┴───────────────────────────────────┴───────────────┘
```

Reviewed By: NickGerleman

Differential Revision: D90346356
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. fb-exported meta-exported p: Facebook Partner: Facebook Partner

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants