Sha256: ce1dc699cf109a00cfedada57edcda0543ed8a2164e436be7a6331a73eb3f881

Contents?: true

Size: 1.88 KB

Versions: 17

Compression:

Stored size: 1.88 KB

Contents

require 'xampl_generated_code/RandomPeople'
require 'people'
require 'settings'

module RandomPeople

  #<people pid=''
  #        xmlns="http://xampl.com/people">
  #    <person pid=''
  #            given-name=''
  #            surname=''
  #            email=''
  #            phone=''>
  #        <address pid=''
  #                 street-address=''
  #                 city=''
  #                 state=''
  #                 postal-code=''/>
  #    </person>
  #</people>

  5.times do
    found1 = []
    found2 = []
    found3 = []

    start_query_at = Time.now
    found1 = Xampl.transaction("random-people") do
      Xampl.query do | q |
        q.add_condition('city', :equals, 'TORONTO')
        q.add_condition('email', :ends_with, 'dodgit.com')

#        q.setlimit(10, 10)

        q.order_by('surname', :strasc)
      end
    end

    start_find_at = Time.now
    found2 = Xampl.transaction("random-people") do
      Person.find_by_query do | q |
        q.add_condition('city', :equals, 'TORONTO')
        q.add_condition('email', :ends_with, 'dodgit.com')

#        q.setlimit(10, 10)

        q.order_by('surname', :strasc)
      end
    end

    start_find_pids_at = Time.now

    found3 = Xampl.transaction("random-people") do
      Xampl.find_pids do | q |
        q.add_condition('city', :equals, 'TORONTO')
        q.add_condition('email', :ends_with, 'dodgit.com')

#        q.setlimit(10, 10)

        q.order_by('surname', :strasc)
      end
    end
    done = Time.now

    #  found1.each do | person_meta |
    #    puts "surname: #{ person_meta['surname']}, given: #{ person_meta['xampl'].given_name }"
    #  end

    puts
    puts "query    :: found: #{ found1.size }, in: #{ start_find_at - start_query_at }"
    puts "find     :: found: #{ found2.size }, in: #{ start_find_pids_at - start_find_at }"
    puts "find pids:: found: #{ found3.size }, in: #{ done - start_find_pids_at}"
  end
end

Version data entries

17 entries across 17 versions & 2 rubygems

Version Path
hutch-xamplr-1.1.0 examples/random-people-shared-addresses/query.rb
hutch-xamplr-1.1.1 examples/random-people-shared-addresses/query.rb
hutch-xamplr-1.1.2 examples/random-people-shared-addresses/query.rb
hutch-xamplr-1.1.4 examples/random-people-shared-addresses/query.rb
hutch-xamplr-1.2.0 examples/random-people-shared-addresses/query.rb
hutch-xamplr-1.3.0 examples/random-people-shared-addresses/query.rb
hutch-xamplr-1.3.1 examples/random-people-shared-addresses/query.rb
hutch-xamplr-1.3.10 examples/random-people-shared-addresses/query.rb
hutch-xamplr-1.3.11 examples/random-people-shared-addresses/query.rb
hutch-xamplr-1.3.12 examples/random-people-shared-addresses/query.rb
hutch-xamplr-1.3.13 examples/random-people-shared-addresses/query.rb
hutch-xamplr-1.3.14 examples/random-people-shared-addresses/query.rb
hutch-xamplr-1.3.3 examples/random-people-shared-addresses/query.rb
hutch-xamplr-1.3.8 examples/random-people-shared-addresses/query.rb
hutch-xamplr-1.3.9 examples/random-people-shared-addresses/query.rb
xamplr-1.3.15 examples/random-people-shared-addresses/query.rb
xamplr-1.2.0 examples/random-people-shared-addresses/query.rb