Skip to content

Instantly share code, notes, and snippets.

@Alan-FGR
Alan-FGR / test.cs
Last active December 6, 2017 15:14
Proving to some noobs that C# finalizers/dtors aren't reliable :trollface:
using System;
using System.Collections.Generic;
using System.Threading;
class Test
{
public static long count = 0;
public static int dtorTime = 201;
readonly long[] bogus_ = new long[1ul<<12];
@Alan-FGR
Alan-FGR / Benchmark.cs
Created July 13, 2018 01:02
Math Benchmark C#
using System;
using System.Runtime.CompilerServices;
using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Running;
public struct Vec
{
public float x, y, z;
public Vec(float x, float y, float z)
@Alan-FGR
Alan-FGR / MULTITHREADEDresults.txt
Last active July 24, 2018 13:19
SIMD Frustum Culling Performance Results
3.0ghz haswell: 280 340 (g3220)
2.66ghz conroe: 370 400 (e6750)
4.0ghz skylake: 150 170 (i7 6700k)
3.3ghz sandy b EP: 180 220 (e5 1666)
@Alan-FGR
Alan-FGR / ComputeShaderTest.cs
Created September 19, 2018 21:38
Lines 112:115 won't change texture *for reasons*... shader code on L64:65 and MiniTri.hlsl is from SharpDX samples (simple VS/PS)
using System;
using SharpDX;
using SharpDX.D3DCompiler;
using SharpDX.Direct3D;
using SharpDX.Direct3D11;
using SharpDX.DXGI;
using SharpDX.Windows;
using Buffer = SharpDX.Direct3D11.Buffer;
using Device = SharpDX.Direct3D11.Device;
using Color = SharpDX.Color;
@Alan-FGR
Alan-FGR / hack.cs
Created January 15, 2019 02:21
Hacky hack
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using CppSharp;
using CppSharp.AST;
using CppSharp.Generators;
public class AstHack : ILibrary
.method public hidebysig instance int32 First() cil managed
{
.custom instance void [BenchmarkDotNet]BenchmarkDotNet.Attributes.BenchmarkAttribute::.ctor() = ( 01 00 00 00 )
// Code size 80 (0x50)
.maxstack 2
.locals init (int32 V_0,
int32 V_1,
int32 V_2,
int32 V_3,
int32 V_4)
000000013FC25164 | 33C0 | xor eax,eax |
000000013FC25166 | BA FFFFFF00 | mov edx,FFFFFF |
000000013FC2516B | B9 01000000 | mov ecx,1 |
000000013FC25170 | 41:B8 01000000 | mov r8d,1 |
000000013FC25176 | 45:33C9 | xor r9d,r9d |
000000013FC25179 | 41:03C1 | add eax,r9d |
000000013FC2517C | 2BC1 | sub eax,ecx |
000000013FC2517E | 3BC1 | cmp eax,ecx |
000000013FC25180 | 7E 02 | jle primitivewrapperbenchmarks.13FC2518 |
000000013FC25182 | FFC1 | inc ecx |

Broken

Address Assembly Clockticks Instructions Retired CPI Rate Retiring Back-End Bound Front-End Bound
0x140005164 Block 1:
0x140005164 xor eax, eax
0x140005166 mov edx, 0xffffff
0x14000516b mov ecx, 0x1
0x140005170 mov r8d, 0x1
0x140005176 xor r9d, r9d
Address Source Line Assembly Clockticks Instructions Retired CPI Rate Retiring Bad Speculation Back-End Bound Front-End Bound
0x7fe6f7b2df0 0 Block 1:
0x7fe6f7b2df0 408 xor eax, eax
0x7fe6f7b2df2 409 mov edx, 0xffffff
0x7fe6f7b2df7 410 mov ecx, 0x1
0x7fe6f7b2dfc 411 mov r8d, 0x1
0x7fe6f7b2e02 413 xor r9d, r9d
0x7fe6f7b2e05 0 Block 2:
0x7fe6f7b2e05 415 add eax, r9d 247500000 555000000 0.445946 0.109627 0.0106091 0.0459723 0.0282908
cmake_minimum_required(VERSION 3.15.0)
#config vars
set(minECS_BUILD_TESTBED true CACHE BOOL "Builds the SDL-powered testbed")
set(minECS_STATIC_SDL false CACHE BOOL "Links static SDL library")
project(minECS)
add_executable(minECS main.cpp)