-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Improve ZEnvironment get
and prune
performance
#8818
Conversation
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??? |
There was a problem hiding this comment.
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] { |
There was a problem hiding this comment.
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.
No description provided.