Skip to content

Instantly share code, notes, and snippets.

View kshyju's full-sized avatar

Shyju Krishnankutty kshyju

View GitHub Profile
/ Token: 0x06000001 RID: 1 RVA: 0x00002048 File Offset: 0x00000248
.method private hidebysig static
void Main (
string[] args
) cil managed
{
// Header Size: 12 bytes
// Code Size: 25 (0x19) bytes
// LocalVarSig Token: 0x11000001 RID: 1
.maxstack 2
@kshyju
kshyju / CodeToGetCookieValue
Last active June 8, 2020 02:23
CodeToGetCookieValue
document.cookie.split(';').filter(function(item) {
if(item.indexOf('eupubconsent') >= 0){
return item.trim();
}
})
@kshyju
kshyju / ConfigurationRootBenchmark
Last active March 9, 2019 17:18
Benchmark for ConfigurationRoot get method change using for loop instead of Reverse method call
using System.Collections.Generic;
using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Running;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Configuration.Memory;
namespace Microsoft.Extensions.Primitives.Performance
{
public class ConfigurationBenchmark
{
@kshyju
kshyju / UserAgents
Last active May 11, 2024 19:28
User agents
// Opera 63 in OSX
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.100 Safari/537.36 OPR/63.0.3368.35
Chrome in OSX
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.132 Safari/537.36
Safari in OSX
[MemoryDiagnoser]
public class LastBenchmarks
{
string[] segments = "abc/xyz".Split('/');
[Benchmark]
public string LastitemUsingLINQ()
{
return segments.Last();
}
@kshyju
kshyju / Perfview Tips
Last active June 8, 2020 02:21
Perfview tips
Run D:\Windows\System32\inetsrv> appcmd list wps
Get the Id for the app pool for the app
@kshyju
kshyju / IReadOnlyList Enumerator allocation
Created October 20, 2020 18:09
IReadOnlyList ForEach vs Array ForLoop - allocation
Result
``` ini
BenchmarkDotNet=v0.12.1, OS=Windows 10.0.19042
Intel Xeon CPU E5-1650 v4 3.60GHz, 1 CPU, 12 logical and 6 physical cores
.NET Core SDK=5.0.100-rc.2.20479.15
[Host] : .NET Core 3.1.9 (CoreCLR 4.700.20.47201, CoreFX 4.700.20.47203), X64 RyuJIT
DefaultJob : .NET Core 3.1.9 (CoreCLR 4.700.20.47201, CoreFX 4.700.20.47203), X64 RyuJIT
@kshyju
kshyju / DeDupeDictionaryEntries-LINQGroupByFirstvsNONLINQ.cs
Created October 23, 2020 16:49
DeDupeDictionaryEntries-LINQGroupByFirstvsNONLINQ benchamarks
using BenchmarkDotNet.Attributes;
using System;
using System.Collections.Generic;
using System.Linq;
namespace Benchmark_ToListCall
{
[MemoryDiagnoser]
public class DictionaryBenchmarks
{
@kshyju
kshyju / SliceToMultiple-SpanVsSubString
Created March 22, 2021 06:50
SliceToMultiple-SpanVsSubString
using BenchmarkDotNet.Attributes;
using System;
using System.Collections.Generic;
namespace Benchmark_ToListCall
{
[MemoryDiagnoser]
public class StringBenchmarks2
{
private string stringToSlice;
@kshyju
kshyju / LinqVsMyLinq
Last active April 21, 2021 19:26
LinqVsMyLinq-For-JB_Reference
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;