Skip to content

Instantly share code, notes, and snippets.

@buybackoff
buybackoff / gist:e7ceb018e983df1b1573
Last active August 29, 2015 14:23
F# Fast Events
namespace Test
open System
open System.Linq
open System.Linq.Expressions
//thanks to http://v2matveev.blogspot.ru/2010/06/f-performance-of-events.html
// helper type that will perform invocation
type internal Invoker<'D, 'A> = delegate of 'D * obj * 'A -> unit
@buybackoff
buybackoff / C# test via PInvoke
Last active January 2, 2020 17:58
LE query micro benchmark
[Test]
public void CursorShouldGetLessOrEqual() {
_db = _txn.OpenDatabase(flags: DbFlags.None);
var db2 = _txn.OpenDatabase("test_le",
DbFlags.Create | DbFlags.IntegerKey);
using (var cur = _txn.CreateCursor(db2)) {
int[] keys = new int[10000000];
@buybackoff
buybackoff / OrderedDictionary<TKey, TValue>
Last active December 14, 2015 08:49
Generic OrderedDictionary<TKey, TValue> See http://stackoverflow.com/a/15146898/801189 for details.
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
namespace Data
{
[Serializable]
public class OrderedList<TKey, TValue> : IDictionary<TKey, TValue>, IDictionary
{