Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve ZEnvironment get and prune performance #8818

Closed

Conversation

kyri-petrou
Copy link
Contributor

No description provided.

new ZEnvironment(filterKeys(self.map)(tag => set.exists(taggedIsSubtype(tag, _))), index)
.asInstanceOf[ZEnvironment[R]]
// Mutable set lookups are much faster. It also iterates faster. We're better off just allocating here
// Why are immutable set lookups so slow???
Copy link
Member

@guizmaii guizmaii May 8, 2024

Choose a reason for hiding this comment

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

Good question! I asked the question on Twitter: https://x.com/guizmaii/status/1788132848626761850
Maybe some Scala collections experts will be able to tell us 🙂

@@ -60,13 +60,7 @@ private[zio] trait VersionSpecific {
type LightTypeTag = izumi.reflect.macrortti.LightTypeTag

private[zio] def taggedIsSubtype(left: LightTypeTag, right: LightTypeTag): Boolean =
taggedSubtypes.computeIfAbsent(
(left, right),
new java.util.function.Function[(LightTypeTag, LightTypeTag), Boolean] {
Copy link
Member

Choose a reason for hiding this comment

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

This existed due to bugs in Scala.js, I believe.

@kyri-petrou
Copy link
Contributor Author

@jdegoes I'll close this PR as I think it doesn't make much sense to merge it in and change things again for #8828

@kyri-petrou kyri-petrou closed this May 9, 2024
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.

None yet

3 participants