Skip to content

Instantly share code, notes, and snippets.

Avatar

Roman Leventov leventov

View GitHub Profile
View mid_cardinality_simulation.go
import (
"log"
"math/rand"
"testing"
"github.com/montanaflynn/stats"
"gonum.org/v1/gonum/floats"
)
func TestMidCardinalitySimulation(t *testing.T) {
View keybase.md

Keybase proof

I hereby claim:

  • I am leventov on github.
  • I am leventov (https://keybase.io/leventov) on keybase.
  • I have a public key ASDzs8Wl-lVqJjYp08P567ms5Hx5uQ9qFvxqOwkyfiQ3LQo

To claim this, I am signing this object:

View hash_table.py
# (Pseudocode)
def shift_distance(chain_end, base):
return (chain_end - base) & (capacity - 1)
def next(index):
return (index + 1) & (capacity - 1)
def prev(index):
View SmoothieMapBenchmark.java
package tests;
import java.util.*;
import java.util.Map.Entry;
import java.util.concurrent.TimeUnit;
import org.openjdk.jmh.annotations.Benchmark;
import org.openjdk.jmh.annotations.BenchmarkMode;
import org.openjdk.jmh.annotations.Fork;
import org.openjdk.jmh.annotations.Measurement;
@leventov
leventov / Hashing.java
Last active Aug 29, 2015
Zero-allocation-hashing benchmarks
View Hashing.java
package tests;
import com.google.common.hash.HashFunction;
import net.openhft.chronicle.hash.hashing.Accesses;
import net.openhft.chronicle.hash.hashing.Hasher;
import net.openhft.hashing.LongHashFunction;
import org.openjdk.jmh.annotations.*;
import java.util.concurrent.TimeUnit;
View AdvancedIntStatistics.java
package spoon.test;
import spoon.reflect.declaration.*;
import java.util.ArrayList;
import java.util.IntSummaryStatistics;
import java.util.TreeSet;
import java.util.function.Consumer;
import java.util.function.ToIntFunction;
@leventov
leventov / analyze.py
Created Sep 4, 2014
См. http://habrahabr.ru/post/235689/. Инструкция по применению в первом комментарии
View analyze.py
import json
MIN_STARS = 700
with open('{}.json'.format(MIN_STARS)) as json_file:
repos = json.load(json_file)
repos_by_language = {}
by_top = {}
for repo in repos:
@leventov
leventov / memory.txt
Created Jul 21, 2014
Results of "time vs memory" benchmark: https://github.com/OpenHFT/hftc/tree/25511ccb8dd1afd0c11cc2233f24bdd98ffdb108/benchmarks/time-vs-memory. Information about the runsite: Intel Sandy Bridge (2011), L1: 64 KB, L2: 256 KB, L3: 20 MB, 128 GB of RAM. Java8u5.
View memory.txt
loadLevel collections overuseFactor
1 hftc 7.226
1 hftc 10.791
1 hftc 7.470
1 hftc 11.172
1 hftc 7.748
1 hftc 11.576
1 hftc 8.039
1 hftc 11.993
1 hftc 8.339
View BoundedSetContains.java
package tests;
import org.openjdk.jmh.annotations.*;
import java.util.*;
import java.util.concurrent.ThreadLocalRandom;
import java.util.concurrent.TimeUnit;
@BenchmarkMode(Mode.AverageTime)
@Measurement(time = 100, timeUnit = TimeUnit.MILLISECONDS)
View compile
$ ghc -Odph -rtsopts -threaded -fno-liberate-case -funbox-strict-fields -funfolding-keeness-factor1000 -fllvm -optlo-O3 -fexpose-all-unfoldings -fsimpl-tick-factor=500 -ddump-simpl -dsuppress-all zip-columns.hs > z.hs