Skip to content

Instantly share code, notes, and snippets.

View useronym's full-sized avatar

Adam Krupicka useronym

  • Breach VR
  • Trondheim, NO
View GitHub Profile
%% 3 nodes
➜ ebalancer git:(dev) ./test.sh go data_m.log
stream finished, waiting for output (start_time=1428925779552)
sorted 496476 messages in 5.76 seconds ~ 86,193.75/s
➜ ebalancer git:(dev) ./test.sh go data_l.log
stream finished, waiting for output (start_time=1428925795124)
sorted 992952 messages in 10.00 seconds ~ 99,295.2/s
128> timer:tc(fun() -> lists:foreach(fun(Li) -> retrie:lookup_match(Li, TM6) end, I2) end).
{1993891,ok}
132> eprof:analyze().
****** Process <0.21680.0> -- 100.00 % of profiled time ***
FUNCTION CALLS % TIME [uS / CALLS]
-------- ----- ------- ---- [----------]
orddict:from_list/1 1 0.00 0 [ 0.00]
gb_sets:empty/0 3 0.00 0 [ 0.00]
gb_sets:balance_list/2 2 0.00 0 [ 0.00]
%% BINARIES
= re ================================================
3 patterns, 2 captures: 3.466 us (288517.85 per second)
4 patterns, 3 captures: 4.434 us (225515.75 per second)
7 patterns, 3 captures: 6.853 us (145915.53 per second)
= re (direct composition) ===========================
3 patterns, 2 captures: 1.887 us (529997.88 per second)
4 patterns, 3 captures: 2.232 us (447936.36 per second)
4 patterns, no match: 4.439 us (225295.76 per second)
7 patterns, 3 captures: 2.713 us (368580.71 per second)
send_expect(Send, Expect, Socket) ->
io:format("Sending '~s'~n", [Send]),
ok = enm:send(Socket, Send),
receive
{nnreq, Socket, Expect} ->
io:format("Received '~s'~n", [Expect]);
{nnreq, Socket, Other} ->
io:format("Received UNEXPECTED '~s'~n", [Other])
end.
module Combinators where
open import Data.Nat.Base
data Mu (A : Set) : Set where
roll : A → Mu A
unroll : ∀ {A : Set} → Mu A → A
unroll (roll a) = a
Y : ∀ {A : Set} → (A → A) → A
data _and_ (P : Set) (Q : Set) : Set where
_∧_ : P → Q → (P and Q)
∧-elim₁ : {P Q : Set} → (P and Q) → P
∧-elim₁ (p ∧ q) = p
∧-elim₂ : {P Q : Set} → (P and Q) → Q
∧-elim₂ (p ∧ q) = q
∧-comm' : {P Q : Set} → (P and Q) → (Q and P)
open import Data.List
open import Data.Nat.Base
open import Data.Bool.Base
open import Relation.Binary.PropositionalEquality using (_≡_; refl)
repeat : ∀ {l} {A : Set l} → ℕ → A → List A
repeat zero x = []
repeat (suc n) x = x ∷ repeat n x
@useronym
useronym / Bst.agda
Last active July 25, 2016 21:12
Bst.agda
open import Relation.Binary.PropositionalEquality using (_≡_; refl)
open import Data.Bool
open import Data.Maybe
open import Data.Product
module Bst {l} (A : Set l) (_≤A_ : A → A → Bool) where
_isoBool_ : A → A → (_≤A_ : A → A → Bool) → Bool
module Fold where
open import Data.Nat.Base using (ℕ; suc)
data List {l} (A : Set l) : Set l where
[] : List A
_::_ : (x : A) → List A → List A
infixr 6 _::_
module Int where
import Nat using (_+_; _≤_; ≤-antisym)
open import Nat using (ℕ; zero; suc)
open import Bool using (𝔹; ⊤; ⊥; ¬_; _⇒_; _⊕_; if_then_else)
open import Relation using (_≡_; refl; Unit; U; cong₂; 𝔹-contra; antisym)
ℤ-s : ℕ → Set
ℤ-s zero = Unit