Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View fakedrake's full-sized avatar

Chris Perivolaropoulos fakedrake

View GitHub Profile
@fakedrake
fakedrake / load_and_run_ssb.tcl
Last active August 2, 2022 23:58
SSB in sqlite
set queries {
{
select sum(lo_extendedprice*lo_discount) as revenu
from lineorder, date
where lo_orderdate = d_datekey
and d_yearmonthnum = 199401
and lo_discount between 4 and 6
and lo_quantity between 26 and 35
}
(defmacro with-repeating (threads repetitions &rest body)
`(mapc #'sb-thread:join-thread
(loop repeat ,threads
collect (sb-thread:make-thread
(lambda () (loop repeat ,repetitions do ,@body))))))
(defstruct atomic-var
(data 0 :type (unsigned-byte 64)))
(proclaim '(optimize (safety 0) (speed 3)))
(defun subpennant-sym (i) (intern (format nil "subpennant-~D" i)))
(defun pennant-type-name (ty i) (intern (format nil "pennant-type-~D" i)))
(defmacro def-pennant (ty n)
"A pennant is a balanced tree of depth N. (def-pennant 5 integer) expands to
; ... define pennant-type-{0..4}
(struct pennant-type-5
(node :type integer)
(subpennant-0 :type pennant-type-0)
https://drive.google.com/file/d/1tMOUrOVqGLixYPdzLMGFH2TGauqmyEta/view?usp=drivesdk
(define (test)
(import chicken.format simple-loops micro-benchmark vector-lib random-mtzig)
(define workload-size 10)
(define concurrent-workers 20)
(define lookup-array (vector-unfold values 1000000))
(define final-cont 0)
> (test)
; loading /opt/homebrew/Cellar/chicken/5.2.0/lib/chicken/11/format.so ...
; loading /opt/homebrew/Cellar/chicken/5.2.0/lib/chicken/11/simple-loops.so ...
A:start
B:start
A 0:pre
B 0:pre
A 0:post
A 1:pre
B 0:post
(define (test)
(import format)
(iqmport simple-loops)
(define final-cont 0)
(define cont-queue (make-vector 10))
(define cont-queue-front 0)
(define cont-queue-back 0)
(import format)
(define (test)
(define cont-queue (vector-unfold values 10))
(define cont-queue-front 0)
(define cont-queue-back 0)
(define (cont-queue-size)
(- cont-queue-front cont-queue-back))
#include <cstdint>
#include <vector>
#include <atomic>
#include <optional>
// The vectors here are explicitly oragnized as pages. The kernel does
// not provide a way for userland to remap pages, so we remap them by
// hand instead of copying data when concatenating. Specifically we
// create a vector of references to pages that will be read only

Await coroutines

We will use coroutines as custom hyperthreading. We want to be able to dealn with memory as if it were a remote location from where we are fetching data. When issuing a prefetch command we want to switch to a different.