Skip to content
This repository has been archived by the owner on Oct 22, 2024. It is now read-only.

CanonicalizedMap: added constructor fromEntries. #347

Merged
merged 2 commits into from
Jun 7, 2024

Conversation

gmpassos
Copy link
Contributor

@gmpassos gmpassos commented Jun 7, 2024

Currently, the only way to create a CanonicalizedMap is from a fully constructed Map.

With fromEntries, a common use case, we can avoid the creation of an intermediate Map.

Real-world case:

Avoid unnecessary overhead as seen here:

https://github.com/dart-lang/shelf/blob/master/pkgs/shelf/lib/src/headers.dart#L32

https://github.com/dart-lang/http_parser/blob/master/lib/src/case_insensitive_map.dart#L13

Reason:

Improve Dart benchmark performance:

https://sharkbench.dev/web


  • [✅ ] I’ve reviewed the contributor guide and applied the relevant portions to this PR.

@gmpassos
Copy link
Contributor Author

gmpassos commented Jun 7, 2024

FYI: @kevmoo

Copy link
Contributor

@kevmoo kevmoo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Love it! Any notes @devoncarew @natebosch ?

@kevmoo kevmoo merged commit 141d83a into dart-archive:master Jun 7, 2024
6 checks passed
@kevmoo
Copy link
Contributor

kevmoo commented Jun 8, 2024

@gmpassos – LOVE THIS work. We're looking at a few other PRs and should have this published on Monday.

I'll let you follow-up with the shelf PR. Any idea about how improved the perf is here?

@gmpassos
Copy link
Contributor Author

gmpassos commented Jun 8, 2024

@gmpassos – LOVE THIS work. We're looking at a few other PRs and should have this published on Monday.

I'll let you follow-up with the shelf PR. Any idea about how improved the perf is here?

Once this reaches pub.dev I will push a PR on 'http_parser', then one on 'shelf'.

It's all about the tests and merge "ping pong" delay.

@kevmoo,
Thanks for the fast response.

Best regards.

@gmpassos
Copy link
Contributor Author

gmpassos commented Jun 8, 2024

About the performance improvement: I'm conducting many benchmarks using our own API (real-world) code. One bottleneck is the handling of case-insensitive headers. We will continue to check for other "hotspots" once the new fixes are in production.

copybara-service bot pushed a commit to dart-lang/sdk that referenced this pull request Jun 10, 2024
Revisions updated by `dart tools/rev_sdk_deps.dart`.

collection (https://github.com/dart-lang/collection/compare/586a5e8..141d83a):
  141d83a  2024-06-07  Graciliano Monteiro Passos  `CanonicalizedMap`: added constructor `fromEntries`. (dart-archive/collection#347)

convert (https://github.com/dart-lang/convert/compare/302af1b..70940e3):
  70940e3  2024-06-10  Alex Li  ⚡ Upper-cast the return type of the decoder (dart-archive/convert#99)

dartdoc (https://github.com/dart-lang/dartdoc/compare/ddb8fb4..3decf1e):
  3decf1ed  2024-06-07  Sam Rawlins  Restrict validation of runtime renderer files to a single, target version of (dart-lang/dartdoc#3778)

ecosystem (https://github.com/dart-lang/ecosystem/compare/bc25c0c..865b2c5):
  865b2c5  2024-06-07  Devon Carew  update docs and metadata for package:sdk_triage_bot (dart-lang/ecosystem#266)
  268b516  2024-06-06  Devon Carew  initial version of a sdk issue triage bot (dart-lang/ecosystem#264)

http (https://github.com/dart-lang/http/compare/a3567f8..b522000):
  b522000  2024-06-08  Anikate De  fix inconsistent test server behavior (dart-lang/http#1227)

mime (https://github.com/dart-lang/mime/compare/8d2d559..4ca2f5e):
  4ca2f5e  2024-06-10  Sarah Zakarias  Add `topics` to `pubspec.yaml` (dart-archive/mime#126)

Change-Id: I6b6279a4ff0af5ba19cc3c4180389b949f48d623
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/370660
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Devon Carew <devoncarew@google.com>
@kevmoo
Copy link
Contributor

kevmoo commented Jun 13, 2024

https://pub.dev/packages/collection/versions/1.19.0 – this is published @gmpassos !

What's next? Here to help!

@gmpassos
Copy link
Contributor Author

gmpassos commented Jun 14, 2024

@kevmoo,

What's next? Here to help!

http_parser PR:

dart-archive/http_parser#99

mosuem pushed a commit to dart-lang/core that referenced this pull request Oct 18, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants