I'm very green to this Ruby <-> C interaction - so its very likely I'm not doing thing the right way around.
AdamB wrote:However, sounds like you actually want a C extension that operates upon the Ruby structures.
What I have done so far is to calculate the soft selection for my Vertex Edit. So for each vertex in the selection set I needed to find the closest closest distance to any of the vertices not selected. It was the distance
method that was so slow.
I did some tests - created a dummy set of 3d data in C and calculated the soft selection for that. Very fast. But as soon as I made the source data set come from RUBY it became very slow. The C function was setting two sets of ruby arrays of vertices. Getting the X,Y,Z data for each vertex seemed to be very slow - converting Vertex to Point3d and then converting the X,Y,Z into C doubles.
For every vertex in the selection I was iterating the remaining set of vertices and converting them.
What I then did was to do a pre-pass of the non-selected vertices and create an C array of point3d structs. I then got a big speed increase. That's what lead me to the impression that converting Ruby VALUES to C types are expensive.