Skip to content

Instantly share code, notes, and snippets.

View redknightlois's full-sized avatar

Federico Andres Lois redknightlois

View GitHub Profile
using System;
using System.Collections.Generic;
using System.Runtime.CompilerServices;
using System.Text;
using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Attributes.Jobs;
using BenchmarkDotNet.Configs;
using BenchmarkDotNet.Diagnosers;
using BenchmarkDotNet.Environments;
using BenchmarkDotNet.Horology;
00007FFAEE230B92 sub esp,20h
00007FFAEE230B95 mov rcx,7FFB4DA35CC8h
00007FFAEE230B9F call 00007FFB4DF47FB0
00007FFAEE230BA4 mov rsi,rax
00007FFAEE230BA7 mov rcx,rsi
00007FFAEE230BAA call 00007FFB4D3EA1D0
00007FFAEE230BAF mov rcx,rsi
00007FFAEE230BB2 call 00007FFB4DD0DD70
public static void Main(string[] args)
{
int i = 0;
try
{
checked
{
i++;
};
@redknightlois
redknightlois / gist:f52db834a071a36621be47e79e0b48dd
Last active May 5, 2016 00:03
Memory Compare Benchmarks with SIMD
// * Summary *
BenchmarkDotNet=v0.9.4.0
OS=Microsoft Windows NT 6.2.9200.0
Processor=Intel(R) Core(TM) i5-3470 CPU @ 3.20GHz, ProcessorCount=4
Frequency=3218751 ticks, Resolution=310.6795 ns, Timer=TSC
HostCLR=MS.NET 4.0.30319.42000, Arch=64-bit RELEASE [RyuJIT]
JitModules=clrjit-v4.6.1078.0
Type=CompareAlgo Mode=Throughput
using BenchmarkDotNet.Tasks;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace BenchmarkDotNet.Samples.JIT
{
[BenchmarkTask(platform: BenchmarkPlatform.X64, jitVersion: BenchmarkJitVersion.RyuJit, warmupIterationCount: 1, targetIterationCount: 4, processCount: 1)]
public class Jit_StructCopy
@redknightlois
redknightlois / memory-copy.txt
Created November 4, 2015 16:06
Benchmark System.Buffer, BlockCopy and RavenDB Sparrow's implementation.
// ***** Competition: Finish *****
```ini
BenchmarkDotNet=v0.7.8.0
OS=Microsoft Windows NT 6.2.9200.0
Processor=Intel(R) Core(TM) i5-2500K CPU @ 3.30GHz, ProcessorCount=4
HostCLR=MS.NET 4.0.30319.42000, Arch=64-bit [AttachedDebugger] [RyuJIT]
Type=MemoryPerf Mode=Throughput Platform=X64 Jit=RyuJit .NET=HostFramework
```
@redknightlois
redknightlois / Main
Last active October 27, 2015 18:00
RotateBits repro
; Assembly listing for method ConsoleApp1.Program:Main(ref)
; Emitting BLENDED_CODE for X64 CPU with SSE2
; optimized code
; rsp based frame
; partially interruptible
; Final local variable assignments
;
;* V00 arg0 [V00 ] ( 0, 0 ) ref -> zero ref
; V01 tmp0 [V01,T01] ( 2, 4 ) long -> rcx
; V02 tmp1 [V02,T02] ( 2, 4 ) long -> rcx
@redknightlois
redknightlois / Devirtualization.cs
Created September 11, 2015 17:28
Benchmark for devirtualization
using BenchmarkDotNet;
using BenchmarkDotNet.Tasks;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Text;
using System.Threading.Tasks;
@redknightlois
redknightlois / Sparrow.cs
Created July 29, 2015 18:14
Benchmark code for RyuJIT unsafe scenarios
using BenchmarkDotNet;
using BenchmarkDotNet.Tasks;
using Sparrow;
using System;
namespace Sparrow.Tryout
{
[Task(platform: BenchmarkPlatform.X64, jitVersion: BenchmarkJitVersion.LegacyJit)]
[Task(platform: BenchmarkPlatform.X64, jitVersion: BenchmarkJitVersion.RyuJit)]
[Task(platform: BenchmarkPlatform.X64, jitVersion: BenchmarkJitVersion.LegacyJit)]
[Task(platform: BenchmarkPlatform.X64, jitVersion: BenchmarkJitVersion.RyuJit)]
public class Jit_BoolToInt
{
private bool first;
private bool second;
public Jit_BoolToInt()
{
first = true;