Server Makefile does not work #110

Closed
tilsammans opened this Issue Apr 18, 2013 · 7 comments

2 participants

@tilsammans

Sorry for the issue and not pull request, but I was not able to solve it quickly.

When I run rake spec in the server directory, the generated Makefile seems to be invalid.

Compiling on Ruby 1.9 with CC set to gcc-4.2.
checking for ruby.h... yes
creating Makefile
make: *** No targets specified and no makefile found.  Stop.

make: *** No targets specified and no makefile found.  Stop.

It's actually Ruby 2.0.0-p0 and not Ruby 1.9.

My make is GNU Make 3.81 and gcc version 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2335.15.00).

Makefile: https://gist.github.com/tilsammans/5411173

@tilsammans

The problem reported by the compiler was:
cannot load such file -- /Users/joost/Gems/picky/server/lib/performant

@floere
Owner

Thanks Joost!
Very grateful for your feedback. Ruby 1.9 was hardcoded. I fixed that.

I completely rewrote the code to adhere to RubyGems standards and use rake-compile for compilation.

Can you please rebase on floere/picky master and run rake again? (or bundle exec rake)

Currently, the specs need to have a running redis-server (redis-server), a MySQL database (mysql.server start), and possibly ulimit -n 3000 set. I aim to make that more collaborator-friendly, by starting them automatically, or perhaps by separating the specs in groups, and running them selectively.

@tilsammans

Yay, compilation works now!

@tilsammans tilsammans closed this Apr 19, 2013
@tilsammans

I hope you don't mind I continue this discussion here. So strange, I get 13 failing SQLite specs but all the others pass.

  15) Picky::Backends::SQLite immediately indexing backend (no dump needed) handles replacing
     Failure/Error: data.backend described_class.new(realtime: true)
     SQLite3::CantOpenException:
       unable to open database file
     # ./lib/picky/backends/sqlite/basic.rb:53:in `initialize'
     # ./lib/picky/backends/sqlite/basic.rb:53:in `new'
     # ./lib/picky/backends/sqlite/basic.rb:53:in `lazily_initialize_client'
     # ./lib/picky/backends/sqlite/basic.rb:19:in `initialize'
     # ./lib/picky/backends/sqlite.rb:21:in `new'
     # ./lib/picky/backends/sqlite.rb:21:in `create_inverted'
     # ./lib/picky/bundle.rb:85:in `create_backends'
     # ./lib/picky/bundle.rb:76:in `reset_backend'
     # ./lib/picky/category.rb:140:in `reset_backend'
     # (__FORWARDING__):2:in `block in reset_backend'
     # (__FORWARDING__):2:in `each'
     # (__FORWARDING__):2:in `reset_backend'
     # (__FORWARDING__):2:in `reset_backend'
     # ./lib/picky/index.rb:138:in `backend'
     # ./spec/functional/backends/sqlite_spec.rb:95:in `block (3 levels) in <top (required)>'

I'm not sure what the difference is between the passing sqlite specs and the failing. The paths seem to be in order to me. Obviously I don't know the codebase, so maybe it's easier for you?

@floere
Owner

Great!

Regarding the failing SQLite specs: can you try setting ulimit -n 3000? I have yet to understand this problem, sadly. I received multiple pull request from contributors thinking they had solved the problem, but hadn't.

@tilsammans

Setting ulimit does indeed fix it. Sorry -- you told me and I just didn't do it 😸

Anyway now everything runs just fine except performance specs. I'm on a new mac mini (2.6 i7) with flash drive so it shouldn't be too slow. It's just outside the specs:

  1) Performant::Array memory_efficient_intersect with strings should be optimal for 2 small arrays of 50/10_000
     Failure/Error: performance_of { Performant::Array.memory_efficient_intersect(arys) }.should < 0.0015
       expected: < 0.0015
            got:   0.0015395
     # ./spec/performant_spec.rb:123:in `block (3 levels) in <top (required)>'

  2) range queries is semi-reasonably fast with huge ranges
     Failure/Error: performance_of { try.search('0-3000"') }.should < 0.21
       expected: < 0.21
            got:   0.236679
     # ./spec/functional/range_queries_spec.rb:47:in `block (2 levels) in <top (required)>'

  3) Search#terminate_early terminates early
     Failure/Error: (slow/fast).should >= 1.2
       expected: >= 1.2
            got:    1.161987041036717
     # ./spec/functional/terminate_early_spec.rb:175:in `block (2 levels) in <top (required)>'

  4) Picky::Backends::File without options ids should be fast
     Failure/Error: performance_of { @backend.ids(@combinations, :any, :thing) }.should < 0.004
       expected: < 0.004
            got:   0.0048705
     # ./spec/lib/backends/file_spec.rb:86:in `block (4 levels) in <top (required)>'

  5) Picky::Backends::Memory without options ids should be fast
     Failure/Error: performance_of { @backend.ids(@combinations, :any, :thing) }.should < 0.004
       expected: < 0.004
            got:   0.0047345
     # ./spec/lib/backends/memory_spec.rb:112:in `block (4 levels) in <top (required)>'

  6) Picky::Backends::SQLite without options ids should be fast
     Failure/Error: performance_of { @backend.ids(@combinations, :any, :thing) }.should < 0.004
       expected: < 0.004
            got:   0.004792
     # ./spec/lib/backends/sqlite_spec.rb:114:in `block (4 levels) in <top (required)>'
@floere
Owner

No worries ;)

You can create a performance_ratio.rb file in the spec folder with the following content:

module Picky; PerformanceRatio = 0.4 end

Default is 0.5. The duration is multiplied with that number and compared with the number in performance_of { ... } < 0.005 # example specs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment