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

Add missing effect methods #5

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open

Add missing effect methods #5

wants to merge 5 commits into from

Conversation

BalmungSan
Copy link

Hope you like it.

PS: I'm not a native english speaker - so, any suggestions about the README section are greatly appreciated.


import scala.collection.JavaConverters._

private[fs2_mongodb] final class MongoCollectionEffect[F[_], A](
Copy link
Author

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.

Copy link
Author

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.

Copy link
Author

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 ?

@forthy
Copy link

forthy commented Nov 20, 2018

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! 👍

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.

2 participants