Skip to content

Instantly share code, notes, and snippets.

@thedeemon
Last active May 14, 2018 15:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thedeemon/aba0ecc2607d781ebfe81c9fef144704 to your computer and use it in GitHub Desktop.
Save thedeemon/aba0ecc2607d781ebfe81c9fef144704 to your computer and use it in GitHub Desktop.
Test sin & cos speed
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