• Stars
    star
    337
  • Rank 125,272 (Top 3 %)
  • Language
    Rust
  • License
    MIT License
  • Created over 3 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Some bunch of test scripts to generate a SQLite DB with 1B rows in fastest possible way

Fast SQLite Inserts

To find out the fastest way to create an SQLite DB with one billion random rows.

Read this blog post for the more context - Towards Inserting One Billion Rows in SQLite Under A Minute

Leaderboard

(for 100M insertions)

Variant Time
Rust 23 seconds
PyPy 126 seconds
CPython 210 seconds

Current Benchmark

Python

These are the current fastest CPython and PyPy numbers.

$ ./bench.sh

Sat May  8 19:42:44 IST 2021 [PYTHON] running sqlite3_opt_batched.py (100_000_000) inserts
      517.53 real       508.24 user         7.35 sys

Sat May  8 20:03:04 IST 2021 [PYPY] running sqlite3_opt_batched.py (100_000_000) inserts
      159.70 real       153.46 user         5.81 sys

Rust

These are the current fastest Rust numbers

Mon Nov 22 18:47:26 IST 2021 [RUST] basic_batched.rs (100_000_000) inserts

real   0m23.826s
user   0m21.685s
sys    0m2.057s

Mon Nov 22 18:47:50 IST 2021 [RUST] threaded_batched.rs (100_000_000) inserts

real   0m23.070s
user   0m27.512s
sys    0m2.465s

In Memory

Instead of writing to disk, I used a :memory: DB, these are the numbers

Mon May 10 17:40:39 IST 2021 [RUST] basic_batched.rs (100_000_000) inserts
       31.38 real        30.55 user         0.56 sys

Mon May 10 17:39:39 IST 2021 [RUST] threaded_batched.rs (100_000_000) inserts
       28.94 real        45.02 user         2.03 sys

Busy loop time

The amount of time these scripts were taking in just to run the for loops (and no SQL insertion)

$ ./busy.sh

Sun May  9 13:16:01 IST 2021 [PYTHON] busy_loop.py (100_000_000) iterations
      351.14 real       347.53 user         3.39 sys

Sun May  9 13:21:52 IST 2021 [PYPY] busy_loop.py (100_000_000) iterations
       81.58 real        77.73 user         3.80 sys

Sun May  9 13:23:14 IST 2021 [RUST] busy.rs (100_000_000) iterations
       17.97 real        16.29 user         1.67 sys

Sun May  9 13:23:32 IST 2021 [RUST] threaded_busy.rs (100_000_000) iterations
        7.18 real        42.52 user         7.20 sys

Community Contributions

PR Author Result
#2 captn3m0 Reduced the CPython running time by half (from 7.5 minutes to 3.5 minute)
#12 red15 saved 2s from Rust's running time (bringing it to 30s)
#19 kerollmops saved 5s from Rust's running time (bringing it to 23s)

Contributing

All contributions are welcome. If you have any ideas on increasing the performance, feel free to submit a PR. You may also check the current open issues to work on.

License

Released under MIT License. Check LICENSE file more info.

More Repositories

1

rockstar

Makes you a Rockstar C++ Programmer in 2 minutes
Python
4,147
star
2

py-caskdb

(educational) build your own disk based KV store
Python
968
star
3

grpc-errors

A handy guide to gRPC errors
C#
549
star
4

status

HTTP Status for Humans
Python
276
star
5

gg-flip

Highly performant Javascript library to flip the signs
HTML
174
star
6

pytorch-flask-api

Python
166
star
7

pytorch-flask-api-heroku

HTML
160
star
8

haxor

Unofficial Python wrapper for official Hacker News API
Python
153
star
9

go-caskdb

(educational) build your own disk based KV store in Go
Go
134
star
10

slackipy

Automate user invites to your Slack channel!
Python
87
star
11

della

Della is a Django app for managing Secret Santa/Gift Exchange.
Python
48
star
12

Reddit-GoodReads-Bot

Python
32
star
13

little-finger

Clojure
31
star
14

cowin-assist

Telegram Bot to check covid vaccine slot availability on CoWin site
Python
30
star
15

prawoauth2

Helper library to make your life easier using OAuth2 for PRAW
Python
29
star
16

kylo

The FAQ Bot
Python
16
star
17

history-bleed

Check your browser history against Cloud Bleed
JavaScript
13
star
18

score-notify

Displays cricket score as notification. OS X Only.
Python
11
star
19

dev-startups-india

list of Indian startups working on building developer tools
9
star
20

fluvio-go

Rust
8
star
21

saveourcinema

code which powers http://saveourcinema.in
HTML
8
star
22

ares

Slack Moderator
Go
8
star
23

Hocus-Pocus

Simple OS X app which shows hidden files. Written in Swift.
Swift
8
star
24

breast-cancer-prediction

Jupyter Notebook
7
star
25

openshift-tornado-starter

Simple repo to get started on Openshift with Python Tornado
6
star
26

cemetery.io

HTML
5
star
27

sign-flip

JavaScript
5
star
28

isso-openshift

This repo helps you install Isso on Openshift with a single click
Python
5
star
29

brave-browser-hardening

mirror of https://gitlab.com/CHEF-KOCH/brave-browser-hardening
5
star
30

Laozi

Laozi is a Goodreads bot for Telegram
Python
5
star
31

heroku-tornado-starter

Simple repo to get started on Heroku to serve static files using Python Tornado
Python
5
star
32

nightreads

Python
5
star
33

slackipycore

Invite Users to Slack using Python
Python
4
star
34

talkwithme

simple chatroom built using Tornado
Python
4
star
35

unnamed-wip-document-db

a document database (like mongo) written in Python. Uses CaskDB as storage backend.
4
star
36

learning-scraping

A project written in Django, which aims to teach Web Scraping for beginners.
Python
3
star
37

polistats

Google Search Trends of Indian Politics
Python
3
star
38

kekday

Find a Redditor's Cake Day!
HTML
3
star
39

good-human

Python
2
star
40

gh-vue

A simple Vue JS project to display my latest commits from Github
JavaScript
2
star
41

learning-tornado

Python
2
star
42

btree

An in-memory B Tree implementation in Go
Go
2
star
43

tildes-plus

JavaScript
2
star
44

mca_scraper

Python
2
star
45

gofish

Go
2
star
46

little-finger-android

Java
2
star
47

hugo-skyfall

Hugo theme - skyfall
CSS
2
star
48

mvcc-go

Go
2
star
49

reddit-india-books

What does Reddit India likes to read?
Python
2
star
50

mkstemp

A Hacker News Clone
Python
2
star
51

skyfall

Clean Pelican theme for http://avi.im/blag
HTML
2
star
52

offenders

List of Telecos and Companies which break Net Neutrality
2
star
53

Bitbucket-import

Python
1
star
54

monkey

An interpreter for the Monkey Programming Language in Golang
Go
1
star
55

wutong

A naughty Telegram bot
Python
1
star
56

tornado-benchmarks

pointless tornado benchmarks
Python
1
star
57

FoodPin

Swift
1
star
58

rtiman

Kickstarter for RTIs
Python
1
star
59

avinassh.github.io

HTML
1
star
60

bast

Delete your Reddit comment history safely
Go
1
star
61

blag

hosts my blog
CSS
1
star
62

goodreads-export

CSS
1
star
63

little-finger-ios

Swift
1
star
64

inks

Go
1
star
65

Calculator-Swift

Simple Calculator app written using Swift
Swift
1
star
66

honk

Go
1
star
67

ratelimit

Go
1
star
68

heroku-static

Ruby
1
star
69

build-your-regex

Go port of Rob Pike's Regex Engine (from C)
Go
1
star
70

hugo-publish

My Github Actions setup for publishing a Hugo blog
1
star