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.algorithm; | |
import std.conv; | |
import std.stdio; | |
import std.array; | |
import std.range; | |
import std.format; | |
//Compile with ldc2 -O5 -release -disable-boundscheck MagicForest.d | |
struct forest_t{ |
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
#include <stdio.h> | |
#include <stdlib.h> | |
#include <string.h> | |
#define INITIAL_ARRAY_CAPACITY 100 | |
int isPrime(int value){ | |
int i; | |
if (value > 2 && value != 4){ | |
for (i = 2; i < value/2; i++) { |
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
/* After compiling it, eg. with "gcc -Wall -ansi DetermineMajorityValue.c -o DetermineMajorityValue -O3", run with: | |
* "DetermineMajorityValue someInputStringIWantToCheck", where that someInputString is the sequence S. | |
*/ | |
#include <stdlib.h> | |
#include <stdio.h> | |
#include <string.h> | |
/*Defining an array in which the number of each symbol encountered is stored. |
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
/* After compiling it, eg. with "gcc -Wall -ansi DetermineMajorityValue.c -o DetermineMajorityValue -O3", run with: | |
* "DetermineMajorityValue someInputStringIWantToCheck", where that someInputString is the sequence S. | |
*/ | |
#include <stdlib.h> | |
#include <stdio.h> | |
#include <string.h> | |
/*Defining an array in which the number of each symbol encountered is stored. |
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
package main | |
import( | |
"io/ioutil" | |
"strings" | |
"fmt" | |
"flag" | |
"os/exec" | |
) |
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; | |
import std.datetime; | |
enum { | |
NUM_RECORDS = 50 * 1000 * 444 | |
} | |
DMemoryTrade[NUM_RECORDS] trades = void; |
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
#define _POSIX_C_SOURCE 200809L | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <time.h> | |
#include <math.h> | |
#define NUM_RECORDS (50 * 1000 * 1000) | |
struct CMemoryTrade { |
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
package main | |
import ( | |
"fmt" | |
"runtime" | |
"time" | |
) | |
const ( | |
NUM_RECORDS = 50 * 1000 * 1000 |
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
I'm running another benchmark next month, and as you contributed a Scala implementation to the previous two benchmarks I did, I wondered if you'd be interested in contributing one to this one? It's an OpenGL animation benchmark. |
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
use std::num;use std::rand::Rng;struct Vec {x:f32,y:f32,z:f32} | |
impl Add<Vec, Vec> for Vec {fn add(&self, other: &Vec) -> Vec {Vec::new(self.x + other.x, self.y + other.y, self.z + other.z)}} | |
impl Mul<f32, Vec> for Vec {fn mul(&self, &scale: &f32) -> Vec {Vec::new(self.x * scale, self.y * scale, self.z * scale)}} | |
impl num::Zero for Vec {fn zero() -> Vec {Vec::new(0., 0., 0.)}fn is_zero(&self) -> bool {self.x == 0. && self.y == 0. && self.z == 0.}} | |
impl Vec {pub fn new(x: f32, y: f32, z: f32) -> Vec {Vec { x: x, y: y, z: z }} | |
pub fn dot(&self, other: &Vec) -> f32 {self.x * other.x + self.y * other.y + self.z * other.z} | |
pub fn cross(&self, other: &Vec) -> Vec {Vec::new(self.y * other.z - self.z * other.y,self.z * other.x - self.x * other.z,self.x * other.y - self.y * other.x)} | |
pub fn normalise(&self) -> Vec {*self * (1. / num::sqrt(self.dot(self)))}} | |
static G: &'static [i32] =&[0b0000000000000000000,0b0000000000000000000,0b0000000000000000000,0b1110000000000000100,0b1001010010011000100,0b1110010010100011111,0b11 |
NewerOlder