Skip to content

Instantly share code, notes, and snippets.

View Mrnikbobjeff's full-sized avatar

Niklas Schilli Mrnikbobjeff

View GitHub Profile
INFO [2017-02-03 03:56:42Z]: Starting Xamarin Studio 6.2 (build 1798)
INFO [2017-02-03 03:56:42Z]: Running on Mono 4.8.0 (mono-4.8.0-branch/084f912) (64-bit)
INFO [2017-02-03 03:56:42Z]: Operating System: Mac OS X 10.11.6
Darwin Niklass-MacBook-Pro.local 15.6.0 Darwin Kernel Version 15.6.0
Mon Jan 9 23:07:29 PST 2017
root:xnu-3248.60.11.2.1~1/RELEASE_X86_64 x86_64
WARNING [2017-02-03 03:56:42Z]: Storage folder: /Users/niklasschilli/Library/Caches/Xamarin/AppInsights/ad58ff9da41d9e46a009b5b523971c10f8ed4e28
ERROR [2017-02-03 03:56:42Z]: PersistenceTransmitter: Unhandled exception in CreateSenders:
INFO [2017-02-03 03:56:42Z]: GTK: Using gtkrc from /Applications/Xamarin Studio.app/Contents/Resources/lib/monodevelop/bin/gtkrc.mac
WARNING [2017-02-03 03:56:42Z]: Gtk-Warning: Locale not supported by C library.
#include <stdio.h>
#include <stdlib.h>
static unsigned char e2a[256] = {
0, 1, 2, 3,156, 9,134,127,151,141,142, 11, 12, 13, 14, 15,
16, 17, 18, 19,157,133, 8,135, 24, 25,146,143, 28, 29, 30, 31,
128,129,130,131,132, 10, 23, 27,136,137,138,139,140, 5, 6, 7,
144,145, 22,147,148,149,150, 4,152,153,154,155, 20, 21,158, 26,
32,160,161,162,163,164,165,166,167,168, 91, 46, 60, 40, 43, 33,
38,169,170,171,172,173,174,175,176,177, 93, 36, 42, 41, 59, 94,
public unsafe int FreeFasterSimplifiedAsmAlignedNonTemporalUnrolledUnsafePin(T obj)
{
var items = _items;
var length = items.Length;
var nullVector = Vector256<long>.Zero;
fixed (long* addrPtr = &itemsRef[0])
{
var aligned = (long*)(((ulong)addrPtr + 31UL) & ~31UL);
var pos = (int)(aligned - addrPtr);
for (int w = 0; w < pos; w++)
@Mrnikbobjeff
Mrnikbobjeff / AvxNullFind.cs
Last active September 21, 2020 10:57
quick hacky way to find null references
using System;
using System.Runtime.CompilerServices;
using System.Runtime.Intrinsics;
using System.Runtime.Intrinsics.X86;
using System.Threading;
namespace ObjectPools
{
public class FastRefPool<T> where T : class
{
@Mrnikbobjeff
Mrnikbobjeff / AllocationProof.cs
Last active November 25, 2019 18:47
It can allocate more :O
using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Running;
namespace AllocationBenchmark
{
[DryCoreJob, DryClrJob]
[MemoryDiagnoser]
public class FormatAllocation
{
[Benchmark]
internal class NoReturn<TReturn, TException> where TException : Exception
{
static NoReturn()
{
bool GetCorrectConstructor(ParameterInfo[] parameters) => parameters.Length == 1 && parameters[0].ParameterType == typeof(string);
var constructors = typeof(TException).GetConstructors();
var target = Expression.Label();
var constructor = constructors.Single(c => GetCorrectConstructor(c.GetParameters()));
var messageExpression = Expression.Parameter(typeof(string), "message");
var newException = Expression.New(constructor, messageExpression);

Hi, my name is Niklas Schilli. I am a .Net fanatic, a student and am loooking for opportunities to work in high-performance scenarios

using System.Buffers;
using System.IO;
using System.Threading.Tasks;
using AppKit;
using CoreGraphics;
using CoreImage;
using Foundation;
using ImageIO;
using MobileCoreServices;
protected override void OnActivityResult(int requestCode, Result resultCode, Intent data)
{
base.OnActivityResult(requestCode, resultCode, data);
// we have a valid GUID, so handle the task
if (!string.IsNullOrEmpty(guid) && pendingTasks.TryRemove(guid, out var tcs) && tcs != null)
{
if (resultCode == Result.Canceled)
{
tcs.TrySetCanceled();
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Text;
using System.Text.Json;
using System.Xml;
using System.Xml.Linq;