This file contains 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
window.SE = | |
(function (navigator, | |
document, | |
window, | |
encodeURIComponent, | |
Math, | |
undefined) { | |
"use strict"; | |
var seUrl, clientId, loginUrl, proxyUrl, fetchUserUrl, requestKey, buildNumber = '@@~~BuildNumber~~@@'; |
This file contains 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
const string TypeUrl = "your-elastic-type-url-here"; | |
const int NumRequests = 100000; | |
void Main() | |
{ | |
var randomIds = Enumerable.Range(0, NumRequests).Select(i => Guid.NewGuid()).ToList(); | |
var pipelined = ProfileRequests(randomIds, Pipelined); | |
var nonPipelined = ProfileRequests(randomIds, NonPipelined); | |
This file contains 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
public static bool ContainsTokenMonty(string value, string token, char delimiter = ';') | |
{ | |
// this code assumes you're running x64 | |
// it _works_ regardless, but some ifdef junk for x32 | |
// would be handy if you care about ideal x32 perf | |
const int charsPerLong = sizeof(long) / sizeof(char); // 4 | |
const int charsPerInt = sizeof(int) / sizeof(char); // 2 | |
const int bytesPerChar = sizeof(char) / sizeof(byte); // 2 |
This file has been truncated, but you can view the full file.
This file contains 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
// ***** BenchmarkRunner: Start ***** | |
// Found benchmarks: | |
// OneParam.LinqAF: Job-JNXOUQ(Jit=LegacyJit, Platform=X86, Runtime=Clr, Concurrent=True, Server=True) | |
// OneParam.LINQ2Objects: Job-JNXOUQ(Jit=LegacyJit, Platform=X86, Runtime=Clr, Concurrent=True, Server=True) | |
// OneParam.LinqAF: Job-BBJZSD(Jit=RyuJit, Platform=X64, Concurrent=True, Server=True) | |
// OneParam.LINQ2Objects: Job-BBJZSD(Jit=RyuJit, Platform=X64, Concurrent=True, Server=True) | |
// Validating benchmarks: | |
// ************************** | |
// Benchmark: OneParam.LinqAF: Job-JNXOUQ(Jit=LegacyJit, Platform=X86, Runtime=Clr, Concurrent=True, Server=True) |
This file contains 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.Runtime.CompilerServices; | |
namespace LinqAF | |
{ | |
public static class LinqAFExtensions | |
{ | |
[MethodImpl(MethodImplOptions.AggressiveInlining)] | |
static void Impl<TItem, TEnumerable, TEnumerator>(List<TItem> list, ref TEnumerable e) |
This file contains 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
<Query Kind="Program"> | |
<NuGetReference>Jil</NuGetReference> | |
<Namespace>Jil</Namespace> | |
<Namespace>System.Runtime.Serialization</Namespace> | |
</Query> | |
void Main() | |
{ | |
var objs = new List<MyBaseClass>(); | |
objs.Add(new MySubClass(new [] { "foo", "bar", 3.0f.ToString() })); |
This file contains 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.Threading; | |
namespace LearnMeAThing.Utilities | |
{ | |
/// <summary> | |
/// Handles running pre-registered jobs across some number of threads. | |
/// | |
/// The idea is: | |
/// - make a job runner with a certain number of threads and a maximum |
This file contains 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.Threading; | |
namespace LearnMeAThing.Utilities | |
{ | |
/// <summary> | |
/// Interface for a re-runnable job, invoked | |
/// as part of a scheduled | |
/// </summary> | |
delegate void JobDelegate<T>(GameState game, T state); |
This file contains 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.Threading; | |
namespace LearnMeAThing.Utilities | |
{ | |
/// <summary> | |
/// An object representing some number of jobs waiting to be completed. | |
/// | |
/// Once WaitForCompletion() returns, references to this object should be | |
/// dropped as it may be handed out by it's associated JobRunner again. |
This file contains 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
# This is based on https://github.com/security-code-scan/security-code-scan/blob/master/SecurityCodeScan/Config/Main.yml | |
# IMPORTANT: YML is very strict about indentation and white spaces | |
Version: 2.1 | |
# Set to 'true' to see more warnings | |
AuditMode: false | |
# Allows to define custom anti CSRF attributes and conditions |
OlderNewer