Avoid calling fmod twice in roundLayoutResultsToPixelGrid #1775

Closed
rshest wants to merge 1 commits from export-D67689065 into main
rshest commented 2024-12-28 01:42:52 -08:00 (Migrated from github.com)

Summary:
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 that some of the calls were redundant.

This replaces the duplicate calls to fmod with an equivalent single round operation, which for clang compiler on Windows bring 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.

Differential Revision: D67689065

Summary: 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 that some of the calls were redundant. This replaces the duplicate calls to fmod with an equivalent single round operation, which for clang compiler on Windows bring 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. Differential Revision: D67689065
vercel[bot] commented 2024-12-28 01:42:57 -08:00 (Migrated from github.com)

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
yoga-website Ready (Inspect) Visit Preview 💬 Add feedback Dec 28, 2024 11:57am
[vc]: #IotITpK0Nc+ttnQiJiHlZlihuIvcMBpIMsISuQfPgBI=:eyJpc01vbm9yZXBvIjp0cnVlLCJ0eXBlIjoiZ2l0aHViIiwicHJvamVjdHMiOlt7Im5hbWUiOiJ5b2dhLXdlYnNpdGUiLCJyb290RGlyZWN0b3J5Ijoid2Vic2l0ZSIsImluc3BlY3RvclVybCI6Imh0dHBzOi8vdmVyY2VsLmNvbS9mYm9wZW5zb3VyY2UveW9nYS13ZWJzaXRlLzJlaUo4UER3cHVuczNQNlI4VUVVUzJoVUpDTjciLCJwcmV2aWV3VXJsIjoieW9nYS13ZWJzaXRlLWdpdC1mb3JrLXJzaGVzdC1leHBvcnQtZDY3Njg5MDY1LWZib3BlbnNvdXJjZS52ZXJjZWwuYXBwIiwibmV4dENvbW1pdFN0YXR1cyI6IkRFUExPWUVEIiwibGl2ZUZlZWRiYWNrIjp7InJlc29sdmVkIjowLCJ1bnJlc29sdmVkIjowLCJ0b3RhbCI6MCwibGluayI6InlvZ2Etd2Vic2l0ZS1naXQtZm9yay1yc2hlc3QtZXhwb3J0LWQ2NzY4OTA2NS1mYm9wZW5zb3VyY2UudmVyY2VsLmFwcCJ9fV19 **The latest updates on your projects**. Learn more about [Vercel for Git ↗︎](https://vercel.link/github-learn-more) | Name | Status | Preview | Comments | Updated (UTC) | | :--- | :----- | :------ | :------- | :------ | | **yoga-website** | ✅ Ready ([Inspect](https://vercel.com/fbopensource/yoga-website/2eiJ8PDwpuns3P6R8UEUS2hUJCN7)) | [Visit Preview](https://yoga-website-git-fork-rshest-export-d67689065-fbopensource.vercel.app) | 💬 [**Add feedback**](https://vercel.live/open-feedback/yoga-website-git-fork-rshest-export-d67689065-fbopensource.vercel.app?via=pr-comment-feedback-link) | Dec 28, 2024 11:57am |
facebook-github-bot commented 2024-12-28 01:43:07 -08:00 (Migrated from github.com)

This pull request was exported from Phabricator. Differential Revision: D67689065

This pull request was **exported** from Phabricator. Differential Revision: [D67689065](https://www.internalfb.com/diff/D67689065)
facebook-github-bot commented 2024-12-28 01:49:50 -08:00 (Migrated from github.com)

This pull request was exported from Phabricator. Differential Revision: D67689065

This pull request was **exported** from Phabricator. Differential Revision: [D67689065](https://www.internalfb.com/diff/D67689065)
facebook-github-bot commented 2024-12-28 03:54:45 -08:00 (Migrated from github.com)

This pull request was exported from Phabricator. Differential Revision: D67689065

This pull request was **exported** from Phabricator. Differential Revision: [D67689065](https://www.internalfb.com/diff/D67689065)
facebook-github-bot commented 2024-12-30 12:43:29 -08:00 (Migrated from github.com)

This pull request has been merged in facebook/yoga@91997d6cd3.

This pull request has been merged in facebook/yoga@91997d6cd348dcfe109dfaf0282e1e03cb708376.

Pull request closed

Sign in to join this conversation.
No description provided.