u/LeftAd1220

bun 1.3.14 officially supports Android, but it's not faster than node
▲ 0 r/termux

bun 1.3.14 officially supports Android, but it's not faster than node

  • node/bun(Android): 660ms
  • bun(glibc on Android): 88ms
  • .
  • I have always been a fan of Bun due to its speed and rich features, and I'm very glad they have built it on Android in the latest version: 1.3.14.
  • However, after testing it with a small piece of benchmarking code, I found that the Android build was not faster than glibc builds or Android Node.js:

​

function heavy(n) {
  let s = 0;
  for (let i = 1; i < n; i++) {
    s += Math.sqrt(i) * Math.sin(i);
  }
  return s;
}

const t0 = performance.now();
const result = heavy(8_000_000);
const t1 = performance.now();

console.log("Result:", result);
console.log("Time:", (t1 - t0).toFixed(2), "ms");
  • glibc build can be run by glibc-runner (termux native) or proot debian and both get the faster result
  • I believe their optimizations might only apply to glibc. Even musl builds are not that fast.
  • While this might defeat the purpose of using Bun, it still has lots of extra features like pseudo-terminal, image resize/rotate, and all kinds of database clients, just to name a few
  • Luckily, os.networkInterfaces() is not broken
  • process.platform is android, same as Node.js, which might break some native bindings
u/LeftAd1220 — 9 days ago