I'm working on a pretty complicated plug-in used to render curtainwall in Sketchup. We're having some trouble with the performance of the plug-in in Windows, so I thought I'd see if I could get some insight.
Specifically, the model doesn't seem to be redrawing at the rate that Ruby appears to be processing operations. This can be seen in the below video:
In this video, I've set up a simple test slider (a jQuery UI widget, for what it's worth) that sends mullion spacing values to Ruby based on the position of its handle. I've coded the slider to record the clock reading when it sends queuries to Ruby, and to not send a queury if the time since the previous query is below a specified threshold. At the beginning of the video, I set the delay to zero, meaning all requests are sent instantly. As the video shows, the resulting performance is quite jerky.
I tested exactly this configuration on OSX and got much smoother performance. When looking into this discrepancy, I added code to print clock readings to the console after operations of interest, and found that, on Windows, queries were actually being sent about 2.5 more frequently than they were on OSX. It got me thinking that perhaps requests were being sent to Windows too frequently.
So, in the video, after I set the delay to zero and move the slider around a bit, I then set it to 60 ms. As the video shows, the resultant performance is much smoother. So, despite the fact Ruby is receiving and executing less queries, modifications to model are registering to the screen more rapidly.
What makes this particularly puzzling is that Ruby seems to think it's completing all of the operations resulting from queries despite not actually doing so. In the final part of the video, I set the delay back to 0, and open up the Ruby console. We've set up the Ruby side of the plug-in code to report the model redraw time after it completes a redraw operation. The video shows that Ruby produces about a dozen or so of these messages for every frame or two of on-screen adjustment. This suggests a disconnect between what Ruby is doing and what it's displaying.
By way of possible solutions: we've built a queuing mechanism into the software that holds queries in an array in javascript and only sends them to Ruby if the queue was previously empty or if it receives confirmation from Ruby that the previous query was dealt with. It doesn't help in this case, however, because, as I mentioned, Ruby thinks it's completing the requested operations (and probably is; it just isn't displaying them).
Has anyone dealt with any similar problems? Any insight would be very much appreciated.