Optimized set.js

length cache, ++i faster operator.