Repository navigation
[pigeon] Optimize data class equality and hashing in Dart, Kotlin, java, and Swift, adds equality in other languages - #11140
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces significant performance optimizations for data class equality and hashing in Dart, Kotlin, and Swift by avoiding the creation of intermediate lists. The changes are well-implemented and include necessary updates to helper utilities like deepEquals and deepHash for robust recursive comparisons. The addition of generator tests for each language is a great way to ensure the new logic is correct. I have a couple of minor suggestions to improve the generator code's maintainability.
|
/gemini review |
|
@stuartmorgan-g your comments are addressed, I'm still planning on reading up a bit on things before landing. |
stuartmorgan-g
left a comment
There was a problem hiding this comment.
Minor notes (mostly orthodontia), but otherwise LGTM.
| return pigeonDeepEquals(name, that.name) | ||
| && pigeonDeepEquals(description, that.description) | ||
| && pigeonDeepEquals(code, that.code) | ||
| && pigeonDeepEquals(data, that.data); |
There was a problem hiding this comment.
This doesn't actually, any non-collections well return first before any type checking.
I'm not following. The first line in this statement is calling pigeonDeepEquals with two strings. We know at compile time they are strings. But we are calling pigeonDeepEquals for them which will do runtime checks for whether they are:
- byte arrays
- int arrays
- long arrays
- double arrays
ListsMapsDoublesFloats
and only then, after all of that, check that the strings are equal.
Can we add a gobject lint tool? |
|
@stuartmorgan-g done done |
|
@stuartmorgan-g While I technically need your review. Gemini said: "You have essentially achieved the holy grail of cross-platform plugin design. You maintained strict, identical behavioral output while perfectly adapting to the efficiency constraints and memory safety rules of each specific compiler." So I think I'm set. |
…Kotlin, java, and Swift, adds equality in other languages (flutter/packages#11140)
flutter/packages@8dcfd11...5909bdd 2026-03-25 [email protected] [ci] add more permissions for create-pull-request (flutter/packages#11302) 2026-03-25 [email protected] [various] Add `unintended_html_in_doc_comment` to analysis options (flutter/packages#11303) 2026-03-25 [email protected] Use deprecated dependency until legacy renderer is removed (flutter/packages#11185) 2026-03-25 [email protected] [in_app_purchase_storekit] Address flaky tests (flutter/packages#11270) 2026-03-25 [email protected] [google_maps_flutter] Fix A2A iOS builds (flutter/packages#11290) 2026-03-25 [email protected] [mustache_template] Fix broken README link (flutter/packages#11306) 2026-03-25 [email protected] [ci] Add a workflow to auto-remove CICD label (flutter/packages#11301) 2026-03-25 [email protected] [various] Convert plugin builds to Kotlin gradle (flutter/packages#11172) 2026-03-25 [email protected] [webview_flutter_platform_interface] Add support for getting cookie (flutter/packages#11037) 2026-03-25 [email protected] [cupertino_icons] Remove empty Dart file (flutter/packages#11308) 2026-03-25 [email protected] [camera] Regenerate iOS example with Swift (flutter/packages#11283) 2026-03-25 [email protected] [pigeon] Optimize data class equality and hashing in Dart, Kotlin, java, and Swift, adds equality in other languages (flutter/packages#11140) 2026-03-25 [email protected] [two_dimensional_scrollables] Fix span border decorations in flipped cross axes (flutter/packages#11334) If this roll has caused a breakage, revert this CL and stop the roller using the controls here: https://autoroll.skia.org/r/flutter-packages-flutter-autoroll Please CC [email protected] on the revert to ensure that a human is aware of the problem. To file a bug in Flutter: https://github.com/flutter/flutter/issues/new/choose To report a problem with the AutoRoller itself, please file a bug: https://issues.skia.org/issues/new?component=1389291&template=1850622 Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
…va, and Swift, adds equality in other languages (flutter#11140) This PR optimizes the generated equality (==) and hashing (hashCode/hash) logic for data classes across All languages. These have been bothering me for a while, and I wanted to break out a new pr before the NI code is in review.
…er#184123) flutter/packages@8dcfd11...5909bdd 2026-03-25 [email protected] [ci] add more permissions for create-pull-request (flutter/packages#11302) 2026-03-25 [email protected] [various] Add `unintended_html_in_doc_comment` to analysis options (flutter/packages#11303) 2026-03-25 [email protected] Use deprecated dependency until legacy renderer is removed (flutter/packages#11185) 2026-03-25 [email protected] [in_app_purchase_storekit] Address flaky tests (flutter/packages#11270) 2026-03-25 [email protected] [google_maps_flutter] Fix A2A iOS builds (flutter/packages#11290) 2026-03-25 [email protected] [mustache_template] Fix broken README link (flutter/packages#11306) 2026-03-25 [email protected] [ci] Add a workflow to auto-remove CICD label (flutter/packages#11301) 2026-03-25 [email protected] [various] Convert plugin builds to Kotlin gradle (flutter/packages#11172) 2026-03-25 [email protected] [webview_flutter_platform_interface] Add support for getting cookie (flutter/packages#11037) 2026-03-25 [email protected] [cupertino_icons] Remove empty Dart file (flutter/packages#11308) 2026-03-25 [email protected] [camera] Regenerate iOS example with Swift (flutter/packages#11283) 2026-03-25 [email protected] [pigeon] Optimize data class equality and hashing in Dart, Kotlin, java, and Swift, adds equality in other languages (flutter/packages#11140) 2026-03-25 [email protected] [two_dimensional_scrollables] Fix span border decorations in flipped cross axes (flutter/packages#11334) If this roll has caused a breakage, revert this CL and stop the roller using the controls here: https://autoroll.skia.org/r/flutter-packages-flutter-autoroll Please CC [email protected] on the revert to ensure that a human is aware of the problem. To file a bug in Flutter: https://github.com/flutter/flutter/issues/new/choose To report a problem with the AutoRoller itself, please file a bug: https://issues.skia.org/issues/new?component=1389291&template=1850622 Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
…er#184123) flutter/packages@8dcfd11...5909bdd 2026-03-25 [email protected] [ci] add more permissions for create-pull-request (flutter/packages#11302) 2026-03-25 [email protected] [various] Add `unintended_html_in_doc_comment` to analysis options (flutter/packages#11303) 2026-03-25 [email protected] Use deprecated dependency until legacy renderer is removed (flutter/packages#11185) 2026-03-25 [email protected] [in_app_purchase_storekit] Address flaky tests (flutter/packages#11270) 2026-03-25 [email protected] [google_maps_flutter] Fix A2A iOS builds (flutter/packages#11290) 2026-03-25 [email protected] [mustache_template] Fix broken README link (flutter/packages#11306) 2026-03-25 [email protected] [ci] Add a workflow to auto-remove CICD label (flutter/packages#11301) 2026-03-25 [email protected] [various] Convert plugin builds to Kotlin gradle (flutter/packages#11172) 2026-03-25 [email protected] [webview_flutter_platform_interface] Add support for getting cookie (flutter/packages#11037) 2026-03-25 [email protected] [cupertino_icons] Remove empty Dart file (flutter/packages#11308) 2026-03-25 [email protected] [camera] Regenerate iOS example with Swift (flutter/packages#11283) 2026-03-25 [email protected] [pigeon] Optimize data class equality and hashing in Dart, Kotlin, java, and Swift, adds equality in other languages (flutter/packages#11140) 2026-03-25 [email protected] [two_dimensional_scrollables] Fix span border decorations in flipped cross axes (flutter/packages#11334) If this roll has caused a breakage, revert this CL and stop the roller using the controls here: https://autoroll.skia.org/r/flutter-packages-flutter-autoroll Please CC [email protected] on the revert to ensure that a human is aware of the problem. To file a bug in Flutter: https://github.com/flutter/flutter/issues/new/choose To report a problem with the AutoRoller itself, please file a bug: https://issues.skia.org/issues/new?component=1389291&template=1850622 Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
…va, and Swift, adds equality in other languages (flutter#11140) This PR optimizes the generated equality (==) and hashing (hashCode/hash) logic for data classes across All languages. These have been bothering me for a while, and I wanted to break out a new pr before the NI code is in review.
flutter/packages@8dcfd11...5909bdd 2026-03-25 [email protected] [ci] add more permissions for create-pull-request (flutter/packages#11302) 2026-03-25 [email protected] [various] Add `unintended_html_in_doc_comment` to analysis options (flutter/packages#11303) 2026-03-25 [email protected] Use deprecated dependency until legacy renderer is removed (flutter/packages#11185) 2026-03-25 [email protected] [in_app_purchase_storekit] Address flaky tests (flutter/packages#11270) 2026-03-25 [email protected] [google_maps_flutter] Fix A2A iOS builds (flutter/packages#11290) 2026-03-25 [email protected] [mustache_template] Fix broken README link (flutter/packages#11306) 2026-03-25 [email protected] [ci] Add a workflow to auto-remove CICD label (flutter/packages#11301) 2026-03-25 [email protected] [various] Convert plugin builds to Kotlin gradle (flutter/packages#11172) 2026-03-25 [email protected] [webview_flutter_platform_interface] Add support for getting cookie (flutter/packages#11037) 2026-03-25 [email protected] [cupertino_icons] Remove empty Dart file (flutter/packages#11308) 2026-03-25 [email protected] [camera] Regenerate iOS example with Swift (flutter/packages#11283) 2026-03-25 [email protected] [pigeon] Optimize data class equality and hashing in Dart, Kotlin, java, and Swift, adds equality in other languages (flutter/packages#11140) 2026-03-25 [email protected] [two_dimensional_scrollables] Fix span border decorations in flipped cross axes (flutter/packages#11334) If this roll has caused a breakage, revert this CL and stop the roller using the controls here: https://autoroll.skia.org/r/flutter-packages-flutter-autoroll Please CC [email protected] on the revert to ensure that a human is aware of the problem. To file a bug in Flutter: https://github.com/flutter/flutter/issues/new/choose To report a problem with the AutoRoller itself, please file a bug: https://issues.skia.org/issues/new?component=1389291&template=1850622 Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
This PR optimizes the generated equality (==) and hashing (hashCode/hash) logic for data classes across All languages. These have been bothering me for a while, and I wanted to break out a new pr before the NI code is in review.