-
Notifications
You must be signed in to change notification settings - Fork 43
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
Pure Ruby masking #48
Conversation
e611ba4
to
bc86dab
Compare
Build appears to be failing because it's trying to run the no-longer-present |
e355d57
to
cf56ea0
Compare
I know that native extensions can pose a problem on Windows. However, I would rather we solve that problem by fixing the native extensions, than by removing them. The native extension in this gem exists because it provides a significant performance improvement over implementing the same logic in Ruby, and I'm unwilling to get rid of it until we've exhausted every possibility for making the native code work with Windows. |
@jcoglan I thought that might be the reason for the native extensions. Can you show me how to benchmark the various masking implementations? Also, how do you feel about pluggable masking? I'd really love to have a pure-Ruby approach here, and I'd like to avoid having to switch to another gem or fork this one. |
79acc17
to
d6719b2
Compare
Updated with better-performing pure Ruby implementation. |
It's a long time since I did the work that introduced the native extensions and I've forgotten what tooling I used at the time, and couldn't give you numbers for current ruby versions. However there are various WS benchmarking tools on github. |
I'm resistant to going down this path for a couple of reasons. First, increasing the number of implementations we need to maintain increases the build complexity and the chances for inconsistencies. In future, I would like more of this library to be written in C, because it's very well suited to the type of processing required here. Ideally I would like to drop the Java version, and eventually work on JRuby will let us use the C extension there too. Having to maintain multiple versions of each bit of functionality increases my workload. Second, a pluggable interface is unlikely to work. The set of functionality covered by C code is likely to change over time and it will be hard to define a stable interface where other implementations could be plugged in. Plugins make plenty of sense for composing functionality -- see the extensions support we already have -- but not for swapping out random bits of performance hacks. In any case, non of this will solve the problem of a gem with C code in it refusing to compile and install on Windows. Do you know of a fallback mechanism that would allow the gem install even if the C code refuses to compile? |
As a middle ground, I would accept a solution that gets the gem working on your system, that does not delete all the native code from the gem. |
5c6c5d6
to
4d65428
Compare
@jcoglan added an additional fallback as per your "middle ground" suggestion |
Just to clarify, what's the experience like at installation time? I was never clear whether your issues stopped the gem from installing, or whether it installed fine but failed to load the native code. |
Does your code work if you remove the |
4d65428
to
cfc45f2
Compare
It should work fine without the clone - updated. |
@jcoglan also, Travis now thinks this is OK (not sure why it failed the previous build) |
Thanks a lot for fixing this. I'm now looking at doing a completely native parser, and that will probably result in there being a wholesale switch between a native parser and a pure ruby one, depending on if I can get the interfaces right. |
@jcoglan thanks for merging! Hopefully you can release a new version soon and I can ditch my forked version of this gem. |
I was having some trouble with Windows, bundler, and the native extensions (see also #12), so here's a pure Ruby version.
/cc @jcoglan