Skip to content

Instantly share code, notes, and snippets.

@shino
Created April 22, 2020 05:14
Show Gist options
  • Save shino/47f88eff61234af8db4167f69bfde06d to your computer and use it in GitHub Desktop.
Save shino/47f88eff61234af8db4167f69bfde06d to your computer and use it in GitHub Desktop.
#!/usr/bin/env gosh
(use scheme.hash-table)
(use rfc.base64)
(define (main args)
(let* ((ht (populate-ht 20000000)))
#?=(hash-table-size ht)
;; ht is not used, just pass it to avoid GC
(decode-base64-loop 100000 ht)
0))
(define (decode-base64-loop . (max-count ht))
(let loop ([count 0])
(cond
((eq? count max-count) 0)
(else
(base64-decode-string "QUJDREVGRw==")
(loop (+ count 1))))))
(define (populate-ht . (max-count))
(let ((ht (make-hash-table eq?)))
(let loop ([count 0])
(cond
((eq? count max-count) ht)
(else
(hash-table-set! ht count (make-string 100 #\x))
(loop (+ count 1)))))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment