Created
January 30, 2014 16:50
-
-
Save AtnNn/8713050 to your computer and use it in GitHub Desktop.
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
| require 'rethinkdb' | |
| include RethinkDB::Shortcuts | |
| doc = { | |
| :archived_date => nil, | |
| :archived_parent_task_guid => nil, | |
| :archived_tree_guid => nil, | |
| :archived_tree_path => "", | |
| :assigned_to_guid => "d0b93cc0-1a4b-4513-98a8-daccb341df23", | |
| :change_date => "2012-06-27T10:04:50Z", | |
| :completion_date => nil, | |
| :context_guid => nil, | |
| :creation_date => "2012-06-19T12:13:17Z", | |
| :done => false, | |
| :due_date => "2014-01-28T23:00:00Z", | |
| :expanded => true, | |
| :hide_until_date => nil, | |
| :manual_sort => false, | |
| :name => "Go through last few quarterly reports to see how they've been done in the past", | |
| :next_sibling_guid => "1351c07c-1780-49f9-a2a7-a1b16fa490aa", | |
| :notes_docx => nil, | |
| :notes_selection_start => 0, | |
| :parent_task_guid => nil, | |
| :percent_done => 0, | |
| :priority_guid => "fe8c366e-60b4-4eeb-a396-55ddc1157208", | |
| :start_date => nil, | |
| :status_guid => "9579ded2-0939-4acd-b158-4551fe70125c", | |
| :stickynote_always_on_top => false, | |
| :stickynote_color => -1, | |
| :stickynote_enabled => false, | |
| :stickynote_position_x_shared => -1, | |
| :stickynote_position_y_shared => -1, | |
| :stickynote_show_task_notes => true, | |
| :stickynote_size_height => -1, | |
| :stickynote_size_width => -1, | |
| :stickynote_transparency => 10, | |
| :time_estimate => 0, | |
| :time_spent => 0, | |
| :tree_guid => "3ab17474-02d2-4394-b7fd-9aedbadd04d6", | |
| :type_guid => nil | |
| } | |
| $c = r.connect(:host => 'localhost', :port => 28018).repl | |
| def reset_table | |
| begin | |
| r.table_drop('test_1920').run | |
| rescue | |
| ensure | |
| r.table_create('test_1920').run | |
| end | |
| end | |
| tbl = r.table('test_1920') | |
| def timeit(name, &b) | |
| start = Time.now | |
| b.call | |
| end_ = Time.now | |
| dur = (end_ - start) | |
| puts "#{name}: #{dur}s" | |
| end | |
| total = 5000 | |
| [5000,1000,100,10,1].each do |batch_size| | |
| ['hard', 'soft'].each do |durability| | |
| reset_table | |
| batch = [doc] * batch_size | |
| timeit "Insert #{total}, #{batch_size} at a time, #{durability} durability" do | |
| (1..(5000 / batch_size)).each do | |
| tbl.insert(batch, :durability => durability).run | |
| end | |
| end | |
| count = tbl.count.run | |
| raise "Bad count: #{count}" unless count == total | |
| end | |
| end |
AtnNn
commented
Jan 30, 2014
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment