In my Vertex Tools extension I have this feature “soft-selection” - it calculates a falloff for a given set of vertices. This was extremely slow when initially written in Ruby. I then ported it to a Ruby C extensions and I got more than 100 times speed improvement.
Note that speed improvement is mostly to gain when you don’t have the need to call Ruby in the middle. I would iterate over all Geom::Point3d
object and convert to an array of C/C++ structs and then do the computations before I’d convert the results back to Ruby.
There is a Ruby C Extension example for SketchUp on the SketchUp GitHub account. It has Visual Studio and Xcode projects set up which you can use for quick tinkering and experimentation. This let you focus on writing the code instead of setting up the compiler: GitHub - SketchUp/ruby-c-extension-examples: Ruby C extension examples