This file contains hidden or 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
CREATE TABLE integers(i INTEGER); | |
INSERT INTO integers VALUES (1), (2), (3), (4), (5), (6), (7), (8), (9), (10); | |
INSERT INTO integers SELECT * FROM integers; | |
INSERT INTO integers SELECT * FROM integers; | |
INSERT INTO integers SELECT * FROM integers; | |
INSERT INTO integers SELECT * FROM integers; | |
INSERT INTO integers SELECT * FROM integers; | |
INSERT INTO integers SELECT * FROM integers; | |
INSERT INTO integers SELECT * FROM integers; | |
INSERT INTO integers SELECT * FROM integers; |
This file contains hidden or 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
--------- | |
|| Q01 || | |
--------- | |
Cold run...DONE | |
1/5...0.410917 | |
2/5...0.415055 | |
3/5...0.407873 | |
4/5...0.411738 | |
5/5...0.409701 | |
--------- |
This file contains hidden or 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
// First missing positive | |
// Array of integers (negative or positive) | |
// [1, -3, 2, -4, 3, -5] | |
// O(n) time | |
// O(n) space |
This file contains hidden or 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
#include <list> | |
#include <vector> | |
#include <chrono> | |
#include <iostream> | |
using namespace std; | |
// compile: clang++ -std=c++11 -O3 benchlist.cpp | |
// List duration: 809ms | |
// Vector duration: 147ms |
This file contains hidden or 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
#include <chrono> | |
#include <iostream> | |
#include <stdlib.h> | |
#include <bitset> | |
#include <vector> | |
// #include "x86/avx.h" | |
// #include "x86/avx512f.h" |
This file contains hidden or 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
#include <chrono> | |
#include <iostream> | |
#include <stdlib.h> | |
#include <bitset> | |
#include <vector> | |
// #include "x86/avx.h" | |
// #include "x86/avx512f.h" |
This file contains hidden or 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
#include <chrono> | |
#include <iostream> | |
#include <stdlib.h> | |
#include <bitset> | |
#include <vector> | |
// #include "x86/avx.h" | |
// #include "x86/avx512f.h" |
This file contains hidden or 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
#include <string> | |
#include <vector> | |
#include <iostream> | |
#include <type_traits> | |
using namespace std; | |
template<typename T> | |
string GetArgumentType() { | |
if (std::is_same<T, int>()) { |
This file contains hidden or 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
import numpy | |
benchmarks = {} | |
def flush_benchmark(fname, benchmark, times): | |
if benchmark == None: | |
return | |
benchmarks[fname][benchmark] = numpy.mean(times) | |
This file contains hidden or 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
import duckdb | |
import numpy as np | |
import pandas as pd | |
import time | |
lineitem = pd.read_csv('duckdb_benchmark_data/tpch_lineitem.csv', names=["l_orderkey","l_partkey","l_suppkey","l_linenumber","l_quantity","l_extendedprice","l_discount","l_tax","l_returnflag","l_linestatus","l_shipdate","l_commitdate","l_receiptdate","l_shipinstruct","l_shipmode","l_comment"], parse_dates=['l_shipdate', 'l_commitdate', 'l_receiptdate']) | |
def udf_disc_price(extended, discount): | |
return np.multiply(extended, np.subtract(1, discount)) |