4 ms·
No, dynamically typed languages literally have runtime type checking built in because the interpreter does not know the type of any individual object until runt
by brigadier132 3y ago
No, dynamically typed languages literally have runtime type checking built in because the interpreter does not know the type of any individual object until runtime.
Everything is stored on the heap, there is no cache locality for objects so every object property access has the performance of a linked list (or hash map, not good), and all method invocations require dynamic dispatch.
What this means is your code will be slow as fuck for no reason. If your code is 100% typed and you managed to find a fully compatible compiler that actually took advantage of the type annotations you could see massive speedups and significantly lower memory usage (we are talking order of magnitude improvements).
- ska 3y agoThis was something nice about CL implementations like SBCL. When you needed fast you can fully type everything and unbox it effectivly, but it got out of your way when you didn't. Something approximating best of both worlds. Of course the fast code started to look like c, but that's not such a bad thing if you could localize it.