Method | Mean | Error | StdDev | Gen0 | Allocated |
---|---|---|---|---|---|
SumLoopShort | 2.371 ns | 0.0380 ns | 0.0356 ns | - | - |
SumLinqShort | 2.849 ns | 0.0505 ns | 0.0473 ns | - | - |
SumLoopLong | 3,557.375 ns | 29.2171 ns | 24.3976 ns | - | - |
SumLinqLong | 599.220 ns | 3.5048 ns | 3.2784 ns | - | - |
ComplexSumLoopLong | 19,158.862 ns | 374.6008 ns | 367.9080 ns | - | - |
ComplexSumLinqLong | 27,317.165 ns | 267.0329 ns | 249.7828 ns | - | 48 B |
ComplexSumLoopShort | 2.676 ns | 0.0363 ns | 0.0283 ns | - | - |
ComplexSumLinqShort | 21.36 ns | 0.2747 ns | 0.2435 ns | 0.0124 | 48 B |
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 minifb::{Key, Window, WindowOptions}; | |
use simdnoise::NoiseBuilder; | |
use std::{thread, time}; | |
const WIDTH: usize = 640; | |
const HEIGHT: usize = 640; | |
fn main() { | |
let mut buffer: Vec<u32> = vec![0; WIDTH * HEIGHT]; |
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
namespace AlphaFront | |
module JsonCustomConverters = | |
open Newtonsoft.Json | |
open Microsoft.FSharp.Reflection | |
open System | |
open System.IO | |
type DuConverter() = | |
inherit JsonConverter() |
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
using System.Collections.Generic; | |
using System.Linq; | |
namespace FB | |
{ | |
public class PQueue<T> | |
{ | |
private SortedDictionary<float, Stack<T>> sdict; |
I hereby claim:
- I am jackmott on github.
- I am jackmott (https://keybase.io/jackmott) on keybase.
- I have a public key whose fingerprint is DE51 EA3B 8EFA E93E 229C C013 2C5A AAC6 CAD9 92F8
To claim this, I am signing this object:
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
// When this function runs in my program on multiple threads, memory corruption eventually happens | |
// When it doesn't run, or runs on only 1 thread, no problems | |
// I can't see what could be thread unsafe about it, am I missing something? | |
public static float SingleCellular2EdgeSimple(float x, float y, float jitter, int seed) | |
{ | |
int xr = (x >= 0) ? (int)(x + 0.5f) : (int)(x - 0.5f); | |
int yr = (y >= 0) ? (int)(y + 0.5f) : (int)(y - 0.5f); | |
float[] distance = { 999999f, 999999f, 999999f, 999999f }; |
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
open System | |
type ASTNode = | |
| Add of (ASTNode * ASTNode) | |
| Sub of (ASTNode * ASTNode) | |
| X | |
| Constant of int | |
let rec Evaluate node x = | |
match node with |
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
let rec ConstantFolding node = | |
match node with | |
| Add (l,r) -> match (ConstantFolding(l),ConstantFolding(r)) with | |
| (Constant v1,Constant v2) -> Constant(v1+v2) | |
| (optL,optR) -> Add(optL,optR) | |
| Sub(l,r) -> match (ConstantFolding(l),ConstantFolding(r)) with | |
| (Constant v1,Constant v2) -> Constant(v1-v2) | |
| (optL,optR) -> Sub(optL,optR) | |
| X -> X | |
| Constant v -> Constant(v) |
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
// Got a minute to revisit this question this morning and cleaned it up a lot | |
// - Jack | |
#define MAX(a,b) (((a)>(b))?(a):(b)) | |
int ctoi(char c){ | |
return (int)(c - '0'); | |
} | |
char itoc(int 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
public static string Wrap(string s, int width, Func<string, int> widthMeasure) | |
{ | |
StringBuilder builder = new StringBuilder(s.Length); | |
var text = s.AsSpan(); | |
int start = 0; | |
int len = 0; | |
for (int i = 0; i < text.Length; i++) { | |
if (text[i] == ' ') | |
{ |
NewerOlder