Skip to content

Instantly share code, notes, and snippets.

@jcoyne
Created October 22, 2015 16:56
Show Gist options
  • Save jcoyne/7c0944ca79140ad4859f to your computer and use it in GitHub Desktop.
Save jcoyne/7c0944ca79140ad4859f to your computer and use it in GitHub Desktop.
#!/usr/bin/env ruby
puts "Loading environment"
require File.expand_path('../../config/environment', __FILE__)
class Foo < ActiveFedora::Base
include ::CurationConcerns::WorkBehavior
property :depositor, predicate: ::RDF::DC.creator, multiple: false
end
i = Foo.create! { |f| f.apply_depositor_metadata 'jcoyne' }
n = 100
require 'benchmark'
n.times do |n|
time = Benchmark.measure do |x|
image = Foo.find(i.id)
fs = FileSet.create! { |f| f.apply_depositor_metadata 'jcoyne' }
image.ordered_members << fs
image.save!
end
puts "#{n} - #{time.real}"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment