Hi, my name is Niklas Schilli. I am a .Net fanatic, a student and am loooking for opportunities to work in high-performance scenarios
This file contains hidden or 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 Microsoft.Graph.Models; | |
using System.Globalization; | |
namespace MsGraph.Reproduction; | |
public class MsGraphReproduction | |
{ | |
[Fact] | |
public void ZonedDateTime_Maps_Time_UTC() | |
{ |
This file contains hidden or 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
[MethodImpl(MethodImplOptions.AggressiveOptimization)] | |
public unsafe static int GreaterThanSimd_Avx2_u(int boundary,ref ReadOnlySpan<int> array) | |
{ | |
Vector128<int> xmm1 = Vector128.Create(boundary); | |
Vector128<int> xmm2 = Vector128<int>.Zero; | |
Vector128<int> xmm3; | |
Vector128<int> xmm4; | |
ref int start = ref MemoryMarshal.GetReference(array); | |
for (nuint i = 0; i < (nuint)array.Length; i += 4) |
This file contains hidden or 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
create table Users( | |
user_id INT NOT NULL AUTO_INCREMENT, | |
user_name VARCHAR(40) NOT NULL, | |
PRIMARY KEY ( user_id ) | |
); | |
create table Documents( | |
doc_id INT NOT NULL AUTO_INCREMENT, | |
originalname VARCHAR(400) NOT NULL, |
This file contains hidden or 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; | |
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; |
This file contains hidden or 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
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(); |
This file contains hidden or 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.Buffers; | |
using System.IO; | |
using System.Threading.Tasks; | |
using AppKit; | |
using CoreGraphics; | |
using CoreImage; | |
using Foundation; | |
using ImageIO; | |
using MobileCoreServices; |
This file contains hidden or 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
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); |
This file contains hidden or 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 BenchmarkDotNet.Attributes; | |
using BenchmarkDotNet.Running; | |
namespace AllocationBenchmark | |
{ | |
[DryCoreJob, DryClrJob] | |
[MemoryDiagnoser] | |
public class FormatAllocation | |
{ | |
[Benchmark] |
This file contains hidden or 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; | |
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 | |
{ |
NewerOlder