[IMP] grid2.js: improve perf