visulator

why should anyone learn assembly

  • it is super important if you write highly performant code like the guts of node
// deps/uv/src/unix/atomic-ops.h
#if defined(__i386__) || defined(__x86_64__)
  int out;
  __asm__ __volatile__ ("lock; cmpxchg %2, %1;"
                        : "=a" (out), "+m" (*(volatile int*) ptr)
                        : "r" (newval), "0" (oldval)
                        : "memory");
  return out;
#else
[...]