6 ms·
Anything that needs C-like levels of performance in Ruby can be implemented in C. The C Ruby API is pretty straightforward. :)
by getsat 15y ago
Anything that needs C-like levels of performance in Ruby can be implemented in C. The C Ruby API is pretty straightforward. :)
- cageface 15y agoI've written C extensions for Ruby and I agree the API is really nice. But a lot of the most useful AI/Machine Learning algorithms involve chunking big data sets through computationally intensive algorithms. This just isn't a strong point for Ruby, C-extension or no.
- wnight 15y agoPremature optimization. If your code runs slowly on larger datasets it'll be easier to write what you need in C then than it will be to guess what you need now.
- delinquentme 15y agoCan you flesh this statement out a bit more? Yes, I'm going to be working with big datasets and if possible I'd like to put the time I've spent learning Ruby to good use. At the same time I'm not at all against learning C++ / java
- Cushman 15y agoWrite your program in Ruby. Make it as fast as you can. Parts will still be slow. Write C extensions for those parts. Eat your cake.
- wnight 15y agoYou probably won't hit a limit, CPUs are fast and even "slow" Ruby can do quite a lot. If you do hit the limit though, and have exhausted algorithmic improvements, you've got your Ruby as an acceptance test for your C++ which will make it unimaginably easier to write correctly. If you tried to do it up front you'd blow up the requirements, if you do it after you've profiled your real-world code you may only need a few lines of critical code.