August 27, 2020 Re: Is there any language that native-compiles faster than D? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Steven Schveighoffer | On Wednesday, 26 August 2020 at 16:24:03 UTC, Steven Schveighoffer wrote: > On 8/26/20 12:00 PM, James Lu wrote: >> On Wednesday, 26 August 2020 at 14:45:48 UTC, Steven Schveighoffer wrote: >>> On 8/25/20 9:13 PM, James Lu wrote: >>>> V8 JavaScript compiles faster: > Compiling an empty main function with dmd takes 0.128 seconds on my system, but of course comparing my system to yours isn't going to be useful. > > Compiling with -betterC an empty main takes 0.065 seconds, which means about half the overhead is spent compiling D runtime setup things? Weird. On my machine both take the same amount of time: ~16ms. |
August 27, 2020 Re: Is there any language that native-compiles faster than D? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Per Nordlöw | On Wednesday, 26 August 2020 at 23:03:08 UTC, Per Nordlöw wrote:
> Hardly any difference in compile-time for the generic version. Impressive.
Is Vox so fast because it doesn't (yet) support implicit function template instantiation (IFTI)?
|
August 27, 2020 Re: Is there any language that native-compiles faster than D? | ||||
---|---|---|---|---|
| ||||
Posted in reply to MrSmith | On Wednesday, 26 August 2020 at 20:10:09 UTC, MrSmith wrote: > On Wednesday, 26 August 2020 at 19:26:17 UTC, Per Nordlöw wrote: >> How should I best build vox for maximum performance? > > It needs cli version passed: > ldc2 -d-version=cli -m64 -O3 -release -boundscheck=off -enable-inlining -flto=full -i main.d -of=./tjc Should add the following flags as well for best performance: `--mcpu=native --defaultlib=libdruntime-ldc-lto.,libphobos2-ldc-lto` The first will enable extra features the current CPU supports, like SSE. The second one will link to druntime and Phobos compiled with LTO enabled, instead of the regular libraries. -- /Jacob Carlborg |
August 27, 2020 Re: Is there any language that native-compiles faster than D? | ||||
---|---|---|---|---|
| ||||
Posted in reply to jmh530 | On Wednesday, 26 August 2020 at 12:40:28 UTC, jmh530 wrote:
> Is it only the Windows release that is compiled with LDC?
Yes, unfortunately.
--
/Jacob Carlborg
|
August 27, 2020 Re: Is there any language that native-compiles faster than D? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Per Nordlöw | On Thursday, 27 August 2020 at 09:47:38 UTC, Per Nordlöw wrote: > Is Vox so fast because it doesn't (yet) support implicit function template instantiation (IFTI)? IFTI is supported, but only in simple cases. Relevant tests: https://github.com/MrSmith33/tiny_jit/blob/master/source/tests/passing.d#L3342-L3434 Macros are not yet implemented. But I have variadic templates. (See tests below IFTI tests). Here is a fun one. Combining #foreach, variadic template function and type functions to get writeln functionality. selectPrintFunc gets run via CTFE and returns alias to relevant function. $ functions work like traits. $type is $alias restricted to types only. void printStr(u8[]); void printInt(i64 i); $alias selectPrintFunc($type T) { if ($isInteger(T)) return printInt; if ($isSlice(T)) return printStr; $compileError("Invalid type"); } void write[Args...](Args... args) { #foreach(i, arg; args) { alias func = selectPrintFunc(Args[i]); func(arg); } } void run() { write("Hello", 42); } |
August 27, 2020 Re: Is there any language that native-compiles faster than D? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Jacob Carlborg | On Thursday, 27 August 2020 at 09:54:36 UTC, Jacob Carlborg wrote:
> On Wednesday, 26 August 2020 at 12:40:28 UTC, jmh530 wrote:
>
>> Is it only the Windows release that is compiled with LDC?
>
> Yes, unfortunately.
>
> --
> /Jacob Carlborg
Didn't that change recently?
In any case, on Arch Linux dmd is compiled with ldc.
|
August 27, 2020 Re: Is there any language that native-compiles faster than D? | ||||
---|---|---|---|---|
| ||||
Posted in reply to MrSmith | On Thursday, 27 August 2020 at 10:29:41 UTC, MrSmith wrote:
> IFTI is supported, but only in simple cases. Relevant tests: https://github.com/MrSmith33/tiny_jit/blob/master/source/tests/passing.d#L3342-L3434
Nice. Are/Will Vox's overloading rules be different from D's?
Is there a list of D features you don't want?
And a list of non-D features you plan?
|
August 27, 2020 Re: Is there any language that native-compiles faster than D? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Per Nordlöw | On Thursday, 27 August 2020 at 14:52:06 UTC, Per Nordlöw wrote:
> Is there a list of D features you don't want?
> And a list of non-D features you plan?
I just read todo.txt.
Do you plan to add qualifiers for pure and safe code?
|
August 27, 2020 Re: Is there any language that native-compiles faster than D? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Per Nordlöw | On Thursday, 27 August 2020 at 14:52:06 UTC, Per Nordlöw wrote: > Nice. Are/Will Vox's overloading rules be different from D's? > > Is there a list of D features you don't want? > And a list of non-D features you plan? Haven't given overloading a thought yet, but D way seems totally ok. Till that point, the lack of overloading wasn't a major pain point, though. I tried to list main differences from D in the readme. I want to have performant ways of introspection and code-generation that utilize CTFE as much as possible. I may add some support for polymorphism, like signatures/traits. I'm not a big fan of poisonous attributes, so not adding them atm (But I have one now - #ctfe, for ctfe-only functions/structs). There are more basic stuff still missing from the language that I need to focus on. |
September 25, 2020 Re: Is there any language that native-compiles faster than D? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Per Nordlöw | On Thursday, 20 August 2020 at 20:50:25 UTC, Per Nordlöw wrote:
> After having evaluated the compilation speed of D compared to other languages at
>
> https://github.com/nordlow/compiler-benchmark
>
> I wonder; is there any language that compiles to native code anywhere nearly as fast or faster than D, except C?
>
> If so it most likely needs to use a backend other than LLVM.
>
> I believe Jai is supposed to do that but it hasn't been released yet.
I just added support for Apple's Swift. It's massively slow on Linux. Check is 61 times slower than dmd and build is 42 times slower than dmd.
./benchmark --languages=D,Swift --function-count=200 --function-depth=450 --run-count=1
outputs (in Markdown)
| Lang-uage | Oper-ation | Temp-lated | Op Time [us/#fn] | Slowdown vs [Best] | Run Time [us/#fn] | Version | Exec |
| :---: | :---: | --- | :---: | :---: | :---: | :---: | :---: |
| D | Check | No | 7.5 | 1.0 [D] | N/A | v2.094.0-rc.1-75-ga0875a7e0 | `dmd` |
| D | Check | No | 8.5 | 1.1 [D] | N/A | 1.23.0 | `ldmd2` |
| D | Check | Yes | 19.8 | 2.6 [D] | N/A | v2.094.0-rc.1-75-ga0875a7e0 | `dmd` |
| D | Check | Yes | 22.9 | 3.0 [D] | N/A | 1.23.0 | `ldmd2` |
| D | Build | No | 27.1 | 1.0 [D] | 50 | v2.094.0-rc.1-75-ga0875a7e0 | `dmd` |
| D | Build | No | 205.6 | 7.6 [D] | 108 | 1.23.0 | `ldmd2` |
| D | Build | Yes | 38.2 | 1.4 [D] | 31 | v2.094.0-rc.1-75-ga0875a7e0 | `dmd` |
| D | Build | Yes | 214.7 | 7.9 [D] | 113 | 1.23.0 | `ldmd2` |
| Swift | Check | No | 461.4 | 61.3 [D] | N/A | 5.3 | `swiftc` |
| Swift | Build | No | 1133.4 | 41.8 [D] | 61 | 5.3 | `swiftc` |
I'll rerun all the benchmarks now.
|
Copyright © 1999-2021 by the D Language Foundation