Skip to content

Instantly share code, notes, and snippets.

@v3ss0n
Created April 10, 2015 08:10
Show Gist options
  • Save v3ss0n/52cbf0bd8291f1651c29 to your computer and use it in GitHub Desktop.
Save v3ss0n/52cbf0bd8291f1651c29 to your computer and use it in GitHub Desktop.
Preformance test of rethinkdb Reads.
{
"cells": [
{
"cell_type": "code",
"execution_count": 17,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"CPU times: user 2.37 s, sys: 9 ms, total: 2.38 s\n",
"Wall time: 2.77 s\n"
]
}
],
"source": [
"import rethinkdb as r\n",
"conn = r.connect(\"localhost\")\n",
"res = []\n",
"def test_rethinkread():\n",
" for doc in r.table(\"test\").pluck(\"a\").run(conn):\n",
" res.append(doc)\n",
"%time test_rethinkread()"
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"def test_rethink_array():\n",
" res = []\n",
" for doc in r.table(\"test\").pluck(\"arr\").run(conn):\n",
" res.append(doc)"
]
},
{
"cell_type": "code",
"execution_count": 19,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"CPU times: user 20.8 s, sys: 85 ms, total: 20.9 s\n",
"Wall time: 22.2 s\n"
]
}
],
"source": [
"%time test_rethink_array()"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 2",
"language": "python",
"name": "python2"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 2
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython2",
"version": "2.7.9"
}
},
"nbformat": 4,
"nbformat_minor": 0
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment