Minimum Enclosing Circle in node.js


After hearing about all the hype surrounding node.js, I decided to test it's raw power by porting the code I wrote to solve the minimum enclosing circle (MEC) problem in Ruby a couple of years ago (Solution in Ruby to the MEC Problem). I also benchmarked the MEC code against various Ruby implementations.

Here are the results:

  • Points: 1: 0.003
  • Points: 10: 0.013
  • Points: 100: 0.451
  • Points: 1000: 8.036
  • Points: 10000: 1447.161

It is probably my crappy implementation, but for long running cases, the code really breaks down. It tracks the Ruby 1.9.1 performance through 1000 points or so, then falls off a cliff. I assume my implementation is creating too much garbage but haven't really had time to dig in to figure out why.

This benchmark is really garbage anyway for node.js -- heavily CPU intensive tasks are not what it was designed for. Most web applications involve blocking IO operations and the evented model of node.js will really shine in that environment.

As an exercise in JavaScript, this was fun. As a measure of node.js performance, it wasn't really useful.

Source code is here. Or you can download it here: mec.js.