you are viewing a single comment's thread
view the rest of the comments
[–] 1 point 5 months ago (2 children)

If I'm understanding you correctly, they're basically doing the same thing as Python under the hood and using a heap-allocated array (vector) of pointers? If so, that should still be orders of magnitude faster than a linked list.

If their implementation is actually a linked list, colour me shocked. My impression was that JavaScript is "decently fast". I've never even considered writing high-performance code in it, but I've heard that the compiler can optimise extremely aggressively, and it's used so widely that I couldn't imagine that it had glaring performance issues like what I would expect to see if every array was actually a linked list under the hood.

  • source
  • parent
  • hideshow 2 child comments
  • [–] 1 point 5 months ago (1 child)

    can't a jit move things around enough that a linked list could be transformed into a memory-backed array if the access pattern requires it.

  • source
  • parent
  • hideshow 1 child comment
  • [–] 1 point 5 months ago

    Sure it can, as long as it retains behaviour according to whatever standard it needs to comply to. My point was rather that I would be very surprised if the actual implementation (at memory level) was a linked list.

  • source
  • parent