-
Notifications
You must be signed in to change notification settings - Fork 419
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
Moved C extensions into a companion gem. #197
Conversation
I've prepared a PR that could be the final release of the atomic gem which was discussed back in May. I've also created an extension gem for the C native code that should resolve some of the issues we've been having with the C extensions not working as I had intended (#170, #181). It implements the plan proposed in #186 (specifically, this plan). My recommendation is that we 1) end-of-life Release 0.8.0 would then be the first release with the Thoughts? @headius @pitr-ch @mighe @chrisseaton @obrok @lucasallan |
What would be the recommended approach for gem authors using concurrent-ruby? Should we try to install/require the correct extensions depending on the end-users environment? Or use vanilla concurrent-ruby and leave it up to the end-user to install/require extensions for themselves? |
@SebastianEdwards The extension gem would only apply to MRI users. All of the Java and Rbx optimizations would still be within the core The only thing the C extensions provide are high-performance atomic objects (very fast locking). But the core gem has pure-Ruby versions of the same locking. Using the extensions gem would provide no additional functionality, just a potential performance boost for long running applications. For gem authors using This is the reason we're being so careful to not force the C extensions on our users. The benefits they provide are really an edge case when extreme high performance is needed for long running applications on MRI. Would that work for your needs? |
Hello @jdantonio, Firstly thanks, this is lot of work and I can imagine not always fun. I have couple of notes:
|
Splitting in two gems seems like the best path, here are some thoughts:
|
I think we want the same thing: "user should still be able to use the atomic methods without using the full concurrent-ruby". I think that is a good approach in general to be able to load just parts of concurrent-ruby. |
exactly :) For me the end result is that I avoid everything using activesupport like the plague unless I really need to, I am confident concurrent-ruby won't take the same route and do things more intelligently. |
All good suggestions. Some thoughts, in no particular order:
|
Regarding the precompiled C-extensions on
In this way it will work for majority of the users without problems, if we don't add the precompiled C-extensions to |
@pitr-ch I understood what you meant regarding the C extensions. I'm just concerned that it will cause more confusion. The approach you suggest means that the C code will live in two places: the This approach would also lead to a little extra internal complexity. We would have to include checks for cases where both a pre-compiled With 0.7.0 I tried to be "clever" and automatically ease the burden of C extensions on our users. That didn't work out so well. Now I think that a conventional approach, though less elegant, might be less error-prone. I'm certainly open to your suggestion if others think it's the more elegant approach so it's definitely worth more discussion. |
Since the C extension provide a minor boost in performance I think that's fine to have it in its own gem, you can look at listen/guard for an example of standalone gems with optional c extensions gem. |
PR #205 builds two gems from one repository. Please move further discussion to that PR. |
This is what this gem will look like if we move the C extensions into the concurrent-ruby-ext gem.
Packaging this repo
From this repo we would create two builds:
We can retain the Java extensions in this rep because the pre-compiled Java build has worked flawlessly.
Packaging the extensions repo
The companion gem
concurrent-ruby-ext
will contain only pure-C code and a small amount of supporting Ruby code. We would still use the automated build process to create pre-compiled binaries. The difference is that the "base" gem version will compile on install if a pre-compiled package is not available. So we would push the following gems:Usage
In your code make sure you require the extension gem before you require the core gem: