5 ms·
> V is compiled directly to x86_64 machine code (ARM support is coming later) with no overhead, so the performance is on par with C. Direct compilation to x86-
by pcwalton 8y ago
> V is compiled directly to x86_64 machine code (ARM support is coming later) with no overhead, so the performance is on par with C.
Direct compilation to x86-64 machine code does not get you performance on par with C (by which I assume the author means GCC or Clang). The optimization pipelines of GCC and Clang have had decades of work put into them by some of the best compiler engineers in the world.
Since the author states that the compilation time is linear, this would seem to imply that a full suite of optimizations are not being done, since many optimizations done by GCC and Clang have nonlinear complexity. It is easy to get fast compilation if you don't perform optimizations.
> - Thread safety and guaranteed absence of data races. You no longer have to constantly ask yourself: "Is this thread safe?" Everything is! No perfomance costs either. For example, if you are using a hash map in a concurrent function, a thread safe hash map is used automatically. Otherwise a faster single thread hash map is used.
This description doesn't guarantee freedom from data races. (Java's memory model basically fits this description, for instance, except for the specific case of hash tables, which aren't built into the language.) Even if it did, the tricky part is determining what a "concurrent function" is. The obvious ways one might imagine doing this tend to fall down in the face of higher-order functions.
- ww520 8y agoGCC/Clang will definitely optimize better. One way to piggyback on those is for V to spit out C code and let GCC/Clang to do the hard work to produce production mode code, while V can still do fast compilation for development mode code.
- rohan1024 8y agoAuthor added the same thing to description after his comment here
- amedvednikov 8y agoYes, you are right. I had a mental note to update the description, I never expected this to be posted on HN so early :) Just updated it: > V is compiled directly to x86_64 machine code (ARM support is coming later). There's also an option to generate C code to support more platforms and achieve better performance by using sophisticated GCC/clang optimization.
- paulddraper 8y agoThanks!
- kupiakos 8y agoWhy not output to LLVM code instead of C?
- coldtea 8y agoBecause that would tie you to LLVM (a moving target), and to platforms where LLVM is supported.
- amedvednikov 8y agoLLVM is a huge dependency. It's very complex and slow. And it's C++ :) I want every part of the language ecosystem to be simple so that everyone can contribute.
- bakul 8y agoMay be you should say "LLVM will be considered once its code is converted to V." :-)
- amedvednikov 8y ago:)