Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@adamgfraser
Copy link
Contributor

No description provided.

@adamgfraser adamgfraser requested review from jdegoes and vigoo November 15, 2023 03:13
@adamgfraser adamgfraser merged commit eaf15b6 into zio:series/2.x Nov 15, 2023
@adamgfraser adamgfraser deleted the differ branch November 15, 2023 04:26
map - tag -> patch.combine(AddService(newService, tag))
}
}
missingServices.foldLeft(patch) { case (patch, (tag, _)) =>
Copy link
Member

Choose a reason for hiding this comment

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

There's unfortunately still massive allocation in here. I think we can do a few things:

  1. Short term, make sure the happy path (no differences) is special-cased and involves no allocations (actually, that's impossible, since you can't even look at the contents of a map without allocations, but we could get close) and minimal indirection;
  2. Long-term, see about NOT using Scala's Map for the environment, but rather switch to a register + array-based implementation that is ideal for "small maps", and could achieve minimal allocations for many operations.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The first one is what we're doing here. If the two maps are the same just immediately return an empty patch. The second one we could definitely look at. I think the size we have to optimize for is approximately one hundred services so we just have to make sure we actually come out ahead there.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants