3 ms·
It's not, as Nim clearly shows. How do you optimize code without knowing the types of variables?
by xigoi 4y ago
It's not, as Nim clearly shows.
How do you optimize code without knowing the types of variables?
- moonchild 4y agoThe experience of writing nim is very different from the experience of writing common lisp. Nim may be more mutable than c, but that is not saying much. > How do you optimize code without knowing the types of variables? Very carefully.
- samatman 4y agoThe Mike Pall method uses a typed SSA intermediate language, and adds trace guards anywhere it can't guarantee a single type. LuaJIT optimizes fairly well.
- vegai_ 4y agoNim does not show that at all, as it is not really that interactive.
- xigoi 4y agoNimScript is. Unfortunately, it's quite abandoned.
- mbrodersen 4y agoF# and ocaml does that all the time using type inference.
- mhh__ 4y agoGuesswork, static analysis, experiment etc. JSC does all kinds of black magic to make JavaScript run fast. For a large amount of programs (basically all "classical" programs like you'd read about in the past rather than modern apps) you have a fairly clear path through the code for their data, this means that you can optimize that path. This doesn't mean the performance will be as good as a statically typed language but keep in mind 90% of compiler optimization is basically useless on many programs vs. the 10% that makes the important bits run fast.
- pjmlp 4y agoBy having the compiler doing type inference, and if that isn't enough, you can explicitly define types in Common Lisp. http://clhs.lisp.se/Body/d_type.htm http://clhs.lisp.se/Body/d_type.htm I bet Allegro or Lisp Works don't have any issues generating better code than Nim.