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
let bench n size combine = | |
let plist = | |
let rec loop acc i v = | |
if i = 0 | |
then acc | |
else | |
let acc' = (v, string_of_int v ) :: acc in | |
loop acc' (i-1) (v+1) | |
in | |
loop [] size 0 |
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
let bench n size split = | |
let plist = | |
let rec loop acc i v = | |
if i = 0 | |
then acc | |
else | |
let acc' = (v, string_of_int v ) :: acc in | |
loop acc' (i-1) (v+1) | |
in | |
loop [] size 0 |
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
let bench n size split = | |
let plist = | |
let rec loop acc i v = | |
if i = 0 | |
then acc | |
else | |
let acc' = (v, string_of_int v ) :: acc in | |
loop acc' (i-1) (v+1) | |
in | |
loop [] size 0 |
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
let sink (a,f) = f a | |
let base = () | |
let finish () = () | |
let step () = () | |
let fold (a,f) g = g (a,f) | |
let step0 h (a,f) = fold (h a,f) |
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
open Lwt | |
let n = 1_000_000_000 | |
let time f = | |
let t0 = Unix.gettimeofday () in | |
let a = f () in | |
let t1 = Unix.gettimeofday () in | |
a,(t1-.t0) |
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
type ('k,'v) msg = | |
| Insert of 'k * 'v | |
| Delete of 'k | |
let key = function | |
| Insert (k,_) -> k | |
| Delete k -> k | |
type ('k,'v) row = |
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
type ('a, 'e) result = | |
| OK of 'a | |
| NOK of 'e | |
let invoke (f: 'a -> 'b) x : unit -> 'b = | |
let input, output = Unix.pipe() in | |
match Unix.fork () with | |
| -1 -> (let v = f x in fun () -> v) | |
| 0 -> (* Child *) |
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
(set-foreground-color "green") | |
(set-background-color "black") | |
;; intend using space instead of tabs | |
(setq-default indent-tabs-mode nil) | |
(setq-default tab-width 4) | |
(setq indent-line-function 'insert-tab) | |
(add-to-list 'load-path "~/.emacs.d") | |
(require 'weblogger) |
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
module String = struct | |
include String | |
let show (t:string) = Printf.sprintf "%S" t | |
let pp formatter t = | |
Format.pp_print_string formatter t | |
end | |
module type E = sig |
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
#!/usr/bin/env bash | |
set -x | |
echo $(gcc --version) | |
VERSION=3.12 | |
shared_lib_file="/usr/local/lib/librocksdb.so.${VERSION}" | |
if [ -e $shared_lib_file ]; then | |
echo "$shared_lib_file exists" | |
else | |
echo "cloning, building, installing rocksdb" |
NewerOlder