Skip to content

Instantly share code, notes, and snippets.

View vyzo's full-sized avatar

vyzo vyzo

  • Internet
  • Planet Earth
View GitHub Profile
@vyzo
vyzo / params.txt
Created March 17, 2020 18:39
peer score parameters back of the envelope
aggregate message rate 120/s
message/mesh peer with 6 mesh peers -> 20/s; with 12 -> 10/s
30 -> sum(n = 0...30, 10 * expt(.97, n)) -> 19.966431048561404
maximum in 2min, +1; in 30s +.25
TimeInMeshWeight 1/120
TimeInMeshQuantum -> 1s
TimeInMeshCap -> 120
@vyzo
vyzo / pythagorean3.ss
Created November 5, 2019 11:09
pythagorean triples with for loops and explicit step
(import :std/iter)
(export main)
(def (main)
(declare (fixnum) (not safe))
(def i 1)
(let/cc break
(for* ((z (in-naturals 1))
(x (in-range 1 z 1))
(y (in-range x z 1)))
@vyzo
vyzo / pythagorean2.ss
Created November 5, 2019 10:46
pythagorean triples with hand-written loops
(import :std/iter)
(export main)
(def (main)
(declare (fixnum) (not safe))
(def i 1)
(let/cc break
(let lpz ((z 1))
(let lpx ((x 1))
(if (< x z)
@vyzo
vyzo / pythagorean.ss
Created November 5, 2019 10:37
pythagorean triples with for loops
(import :std/iter)
(export main)
(def (main)
(declare (fixnum) (not safe))
(def i 1)
(let/cc break
(for* ((z (in-naturals 1))
(x (in-range 1 z))
(y (in-range x z)))
@vyzo
vyzo / gxwc25.ss
Created October 28, 2019 11:39
like gxwc20, but with the hash function written in C.
(import :std/net/bio
:std/os/fdio
:std/os/fcntl
:std/sort
:std/foreign)
(export main)
(declare (not safe))
(def (open-stdout-buffer (bufsz 4096))
(open-fd-output-buffer 1 bufsz))
@vyzo
vyzo / gxwc22.ss
Last active October 27, 2019 19:52
wc with mmaped files
(import :std/net/bio
:std/os/fdio
:std/os/fcntl
:std/os/error
:std/sort
:std/foreign
:gerbil/gambit/os)
(export main)
(declare (not safe))
@vyzo
vyzo / gxwc20.ss
Created October 27, 2019 16:57
like gxwc19, but using ##u8vector-equal?
(import :std/net/bio
:std/os/fdio
:std/os/fcntl
:std/sort)
(export main)
(declare (not safe))
(def (open-stdout-buffer (bufsz 4096))
(open-fd-output-buffer 1 bufsz))
@vyzo
vyzo / gxwc19.ss
Created October 27, 2019 16:41
wc with open addressing table/quadratic probing
(import :std/net/bio
:std/os/fdio
:std/os/fcntl
:std/sort)
(export main)
(declare (not safe))
(def (open-stdout-buffer (bufsz 4096))
(open-fd-output-buffer 1 bufsz))
@vyzo
vyzo / gxwc18.ss
Created October 27, 2019 13:19
Like gxwc16, but with some strategic disabling of interrupts
(import :std/net/bio
:std/os/fdio
:std/os/fcntl
:std/sort)
(export main)
(declare (not safe))
(def (open-stdout-buffer (bufsz 4096))
(open-fd-output-buffer 1 bufsz))
@vyzo
vyzo / gxwc16.ss
Last active October 27, 2019 11:33
wc with gerbil#365; also fixes a minor bug in the hash function
(import :std/net/bio
:std/os/fdio
:std/os/fcntl
:std/sort)
(export main)
(declare (not safe))
(def (open-stdout-buffer (bufsz 4096))
(open-fd-output-buffer 1 bufsz))