Last active
May 14, 2018 15:20
-
-
Save thedeemon/aba0ecc2607d781ebfe81c9fef144704 to your computer and use it in GitHub Desktop.
Test sin & cos speed
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import std.stdio, std.math; | |
void main() { | |
double s = 0; | |
foreach(i; 0..50_000_000) { | |
double t = i / 100.0; | |
s += sin(t)*cos(t)*200.0; | |
} | |
writeln(s); | |
} | |
/* | |
output: 333.728 | |
Times: | |
Linux: seconds binary size | |
DMD 2.078.1: 64-bit 5.35 919264 | |
LDC 1.9.0: 64-bit 4.92 852256 | |
Windows: | |
DMD 2.080 32-bit 5.47 290844 | |
DMD 2.080 64-bit 4.80 501248 | |
LDC 1.9.0 64-bit 1.10 !!! 701952 | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment