-
Notifications
You must be signed in to change notification settings - Fork 9
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
Add missing effect methods #5
base: master
Are you sure you want to change the base?
Conversation
|
||
import scala.collection.JavaConverters._ | ||
|
||
private[fs2_mongodb] final class MongoCollectionEffect[F[_], A]( |
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.
I've been thinking about this value class, and I'm not completely sure if no instantiation occurs when using it. Because, since this is created in an extension method of another (implicit) value class.
I'll try to make some research about that, cause if when can't avoid the instantiaton of this class, it would be better if we include the implicit Async[F]
as a class constructor argument.
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.
Apparently, there is no way to ensure no instantiation occurs, but probably the JIT will inline them anyways.
Also, I followed @Ichoran (hope you don't mind me tagging you here) advice, and marked the extension methods with @inline
- as an attempt to force the inline in the scala compiler.
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.
@fiadliel I just found this and it seems that adding the @inline
annotation doesn't have any effect.
"The @inline annotation only has an effect if the inliner is enabled. It tells the inliner to always try to inline the annotated method or callsite".
Since, this a library I think is a bad idea to activate the inliner, and probably most users won't do it either. Thus, we should just leave the code as it is, and hope that the JIT will optimize the calls.
So, I think is better to remove all @inline
annotations, they add clutter to the code.
What do you think ?
Any chance that Mr Luis Miguel Mejía Suárez's pull request can be merged and publish to Maven repository any time soon? By the way, thanks to Mr Luis Miguel Mejía Suárez's great contribution! 👍 |
Hope you like it.
PS: I'm not a native english speaker - so, any suggestions about the README section are greatly appreciated.