It's not, as Nim clearly shows.
How do you optimize code without knowing the types of variables?
How do you optimize code without knowing the types of variables?
http://clhs.lisp.se/Body/d_type.htm
I bet Allegro or Lisp Works don't have any issues generating better code than Nim.
> How do you optimize code without knowing the types of variables?
Very carefully.
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.