Files
yoga/yoga
Ruslan Shestopalyuk 91997d6cd3 Avoid calling fmod twice in roundLayoutResultsToPixelGrid (#1775)
Summary:
X-link: https://github.com/facebook/litho/pull/1036

Pull Request resolved: https://github.com/facebook/yoga/pull/1775

X-link: https://github.com/facebook/react-native/pull/48404

## Changelog:
[Internal] -

This popped up when profiling some heavy UI performance, calling `fmod` operation in Yoga's `roundLayoutResultsToPixelGrid` in `PixelGrid.cpp` can be expensive, furthermore it turns out that some of the calls were redundant.

This replaces the duplicate calls to fmod with an equivalent single round operation, which for e.g. clang compiler on Windows brings the code in question from ~50 instructions (including 4 call instructions to the fmod function) down to ~30 instructions (without any external calls), and the layout operation being **~1% more efficient** for the particular benchmark I was looking into.

Reviewed By: christophpurrer

Differential Revision: D67689065

fbshipit-source-id: 2a074a1cb81bd7f7a3c414050b9ddda2ba90180f
2024-12-30 12:38:48 -08:00
..
2024-03-04 02:28:02 -08:00
2024-03-04 02:28:02 -08:00
2023-11-20 14:10:56 -08:00
2024-03-19 02:52:40 -07:00
2024-06-13 14:18:45 -07:00
2024-03-04 02:28:02 -08:00
2024-03-19 02:52:40 -07:00