Skip to content

Instantly share code, notes, and snippets.

@a2ndrade
Last active August 5, 2016 15:44
Show Gist options
  • Select an option

  • Save a2ndrade/d95eb35b6bd419dfd6ab to your computer and use it in GitHub Desktop.

Select an option

Save a2ndrade/d95eb35b6bd419dfd6ab to your computer and use it in GitHub Desktop.
Atomic
/ util
appendToTable:{[tableHandle;numberOfRows]
V:"abcdefghijklmnopqrstuvwxyz" / universe of values
e:numberOfRows?1000000000 / 1 billion possible entities
v:numberOfRows?V / select #rows value
t:numberOfRows#1+last get[tableHandle]@`t / next transaction id
.[tableHandle;();,;flip`e`v`t!(e;v;t)]
:e}
/ setup
N:14 / 1,2,3,4,6,8,12,14 yield 676,169,81,49,25,16,9,4 combinations, respectively
tableHandles:`$(":db/",/:raze T,\:/:T:cut[N;"abcdefghijklmnopqrstuvwxyz"]),'"/"
/ run
set[;([] e:`long$(); v:`char$(); t:`long$())] each tableHandles
appendToTable[;1000000] each tableHandles
appendToTable[;10] each tableHandles
/ RESULTS in MBP with 16 GB, 2.6 GHz Intel Core i7 and SSD:
/ 169 Tables
/ 169 million rows appended in 22 seg. total ~2.87 GB (169 tables, 1 million each)
/ after that, 10 rows are appended to all 169 tables in 50-200 ms
/ 25 Tables
/ 25 million rows appended in 3.7 seg. total ~425MB (25 tables, 1 million each)
/ after that, 10 rows are appended to all 25 tables in ~25ms
/ 9 Tables
/ 9 million rows appended in 1.5 seg. total ~153MB (9 tables, 1 million each)
/ after that, 10 rows are appended to all 9 tables in ~8ms
/ 4 Tables
/ 4 million rows appended in 0.6 seg. total ~68MB (4 tables, 1 million each)
/ after that, 10 rows are appended to all 4 tables in ~4ms
/ Throughput : 10-250 writes per second
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment