Sha256: 85022f3b706fe72453321be04a9f1975f4e7938242a5c4917ee224932e0d7eee
Contents?: true
Size: 1.06 KB
Versions: 2
Compression:
Stored size: 1.06 KB
Contents
$:.unshift(File.join(File.dirname(__FILE__), '..', 'lib')) $:.unshift(File.dirname(__FILE__)) require 'rubygems' require 'ncmb' require 'yaml' yaml = YAML.load_file(File.join(File.dirname(__FILE__), '..', 'setting.yml')) NCMB.initialize application_key: yaml['application_key'], client_key: yaml['client_key'] example = NCMB::DataStore.new 'Example' require 'benchmark' ary = [] Benchmark.bm 10 do |r| r.report "Save DataStore" do 100.times do |i| item = example.new item.set('String', "ใในใ#{i}00") item.set('Integer', i) item.set('Boolean', true) item.set('Array', [i, i * 2, i * 3, "Orange", "Tomato"]) item.set('Object', {test1: 'a', test2: 'b'}) item.set('Location', NCMB::GeoPoint.new(30, 50)) item.set('MultipleLine', "test\ntest\n") item.set('Increment', NCMB::Increment.new(i + 1)) item.set('Date', Time.now) item.save ary << item.objectId end end r.report "Delete objects" do ary.each do |objectId| item = example.new(objectId: objectId) item.delete end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
ncmb-ruby-client-0.1.3 | examples/performance.rb |
ncmb-ruby-client-0.1.2 | examples/performance.rb |