Skip to content

Instantly share code, notes, and snippets.

View Mytherin's full-sized avatar

Mark Mytherin

View GitHub Profile
#include "duckdb.hpp"
#include "duckdb/main/appender.hpp"
using namespace duckdb;
using namespace std;
// clang++ -std=c++11 -Isrc/include -L build/release/src -lduckdb benchmark.cpp -o test_benchmark && rm -rf test.db* && time LD_LIBRARY_PATH=build/release/src ./test_benchmark
int main(int argc, char *argv[]) {
// rename chain
// c1 starts a transaction now
REQUIRE_NO_FAIL(c1.Query("BEGIN TRANSACTION"));
// rename in con, c1 should still see "tbl1"
REQUIRE_NO_FAIL(con.Query("ALTER TABLE tbl1 RENAME TO tbl2"));
// c2 starts a transaction now
REQUIRE_NO_FAIL(c2.Query("BEGIN TRANSACTION"));
#include <cstdlib>
#include <vector>
#include <algorithm>
using namespace std;
bool is_doomsayer(int nr) {
return nr < 22;
}
@Mytherin
Mytherin / test.cpp
Last active February 19, 2020 09:00
#include <cstdint>
#include <cstdio>
#include <chrono>
#include <iostream>
#include <string.h>
#include <memory>
#include <cmath>
#include <vector>
Tests run on three columns (a, b, c) of 100M 4-byte integers, randomly generated between the values 0-100
---------------------------------
SELECT SUM(a+b)
FROM table;
---------------------------------
JIT
57ms
Vectorized
65ms
---------------------------------
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import numpy
import sys
import subprocess
import shutil
import platform
import sys, time, numpy, os
if len(sys.argv) < 2:
print("Usage: python3 benchmark-mvcc [hyper|monetdb|sqlite|duckdb]")
exit(1)
try:
os.remove('test.db')
except:
pass
import sqlite3
import os
import time
# showcase of a bug in the python version of sqlite3
# starting an insert with a comment will result in much slower performance and rowcount not being set properly
def test(with_comment):
os.system('rm -f test.db')
con = sqlite3.connect('test.db')
['i', 'me', 'my', 'myself', 'we', 'our', 'ours', 'ourselves', 'you', 'your', 'yours', 'yourself', 'yourselves', 'he', 'him', 'his', 'himself', 'she', 'her', 'hers', 'herself', 'it', 'its', 'itself', 'they', 'them', 'their', 'theirs', 'themselves', 'what', 'which', 'who', 'whom', 'this', 'that', 'these', 'those', 'am', 'is', 'are', 'was', 'were', 'be', 'been', 'being', 'have', 'has', 'had', 'having', 'do', 'does', 'did', 'doing', 'a', 'an', 'the', 'and', 'but', 'if', 'or', 'because', 'as', 'until', 'while', 'of', 'at', 'by', 'for', 'with', 'about', 'against', 'between', 'into', 'through', 'during', 'before', 'after', 'above', 'below', 'to', 'from', 'up', 'down', 'in', 'out', 'on', 'off', 'over', 'under', 'again', 'further', 'then', 'once', 'here', 'there', 'when', 'where', 'why', 'how', 'all', 'any', 'both', 'each', 'few', 'more', 'most', 'other', 'some', 'such', 'no', 'nor', 'not', 'only', 'own', 'same', 'so', 'than', 'too', 'very', 's', 't', 'can', 'will', 'just', 'don', 'should', 'now', 'd', 'll', 'm', 'o',
@Mytherin
Mytherin / scpsync.py
Last active August 12, 2016 11:12
Automatically scp over files in a directory to the target machine whenever they are changed on the host machine.
#!/usr/bin/python
import os, time, sys, datetime
if len(sys.argv) < 3 or ':' not in sys.argv[2]:
print("Usage: scpsync [sourcepath] [dest:destpath] [src?]")
exit(1)
srcheaders = ['.h', '.c', '.py', '.r', '.hpp', '.cpp', '.mal', '.sql', '.malC','.php', '.html']
source = sys.argv[1]