JS version, with perf