Hacker News new | ask | show | jobs
by __s 911 days ago
What's wrong with JS/TS or Lua as a fast dynamic language?
3 comments

One of my favorite things recently is using JS/TS with Julia, usually via a Pluto.jl notebook.

There are also some nice demonstrations showing Julia compiled to web assembly. https://tshort.github.io/WebAssemblyCompiler.jl/stable/examp...

Javascript doesn't compile to native code, so isn't as fast. I've never tried LuaJIT, though, that's supposed to be on par with Julia.
> Javascript doesn't compile to native code, so isn't as fast.

There are AOT compilers for JS.

So there is for Python, but it's still slow. JS has slow semantics. It can't be made in the same performance league as Julia.
I think you mean Julia is on par with LuaJIT? ..maybe exceeds?
I mean, JS, TS, and Python all have at least one major problem: threading. I don’t recall how Lua threads work but I have a feeling it too suffers.
There's threading in lua

https://github.com/torch/threads

Ahhh, interesting. That looks to me like it's more appropriate for "multiple threads working on independent problems" than "multiple threads working on the same problem" due to the potential serialization overhead and limitations.

    Each thread has its own lua_State. However, we provide a serialization scheme which allows automatic sharing for several Torch objects (storages, tensors and tds types). Sharing of vanilla lua objects is not possible, but instances of classes that support serialization (eg. classic objects with using require 'classic.torch' or those created with torch.class) can be shared, but remember that only the memory in tensor storages and tds objects will be shared by the instances, other fields will be copies. Also if synchronization is required that must be implemented by the user (ie. with mutex).
That's not general-purpose multi-processor threading, that's solving it for a very specific sub-problem.