Skip to content

Instantly share code, notes, and snippets.

View badamczewski's full-sized avatar
🙃

Bartosz badamczewski

🙃
View GitHub Profile
diff --git a/src/PowerUp.Core/Decompilation/JITExtensions.cs b/src/PowerUp.Core/Decompilation/JITExtensions.cs
index 88b3397..0f18362 100644
--- a/src/PowerUp.Core/Decompilation/JITExtensions.cs
+++ b/src/PowerUp.Core/Decompilation/JITExtensions.cs
@@ -5,23 +5,18 @@ using System.Runtime.CompilerServices;
using System.Text;
using PowerUp.Core.Console;
using System.Linq;
+using System.Runtime.InteropServices;
using PowerUp.Core.Decompilation.Attributes;
@badamczewski
badamczewski / nullable.asm
Created January 26, 2022 10:43
Nullable
public int? A(int? x, int? y) {
int? sum = 0;
for(int i = 0; i < 1000; i++)
sum += x + y;
return sum.Value;
}
public int? B(int? x, int? y) {
int? sum = 0;
@badamczewski
badamczewski / bench.cs
Last active August 4, 2021 20:56
Bench
using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Configs;
using BenchmarkDotNet.Running;
using System;
using System.Diagnostics;
using System.Runtime.CompilerServices;
using System.Threading.Tasks;
using System.Linq;
using System.Collections.Generic;
public class Bench92
{
public int[] _x = null;
[GlobalSetup]
public void Setup()
{
_x = new int[10000];
}
public class Bench92
{
public int[] _x = null;
[GlobalSetup]
public void Setup()
{
_x = new int[10000];
}
public class Bench92
{
[Benchmark(Baseline = true)]
[MethodImpl(MethodImplOptions.NoInlining)]
[Arguments(0)]
public int A(int x)
{
try { _ = 1; } catch { }
for (int i = 0; i < 10000; i++) {
x++; x++; x++; x++;
public class Bench92
{
[Benchmark(Baseline = true)]
[MethodImpl(MethodImplOptions.NoInlining)]
[Arguments(0)]
public int A(int x)
{
try { _ = 1; } catch { }
for (int i = 0; i < 1000; i++)
x++;
public class Bench73
{
public int[] _a = new int[100_000];
[Benchmark(Baseline = true)]
[MethodImpl(MethodImplOptions.NoInlining)]
public void A()
{
for (int i = 0; i < 10000; i++)
_a[1] = 100;
[IterationCount(10)]
[InvocationCount(100_000_000)]
public class Bench22
{
Random rnd = new Random();
private int x;
public int X
{
get { return rnd.Next(1, 5); }
[DisassemblyDiagnoser(maxDepth: 4)]
public class Bench5
{
public int[] array = null;
public int size = 500_000;
public int x = 10;
public int y = 10;
[GlobalSetup]
public void Setup()