Skip to content

Commit a981fff

Browse files
committed
wip
1 parent eff95f5 commit a981fff

File tree

6 files changed

+59
-37
lines changed

6 files changed

+59
-37
lines changed

.gitignore

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
.tool-versions
2-
*.gem
3-
Gemfile.lock
4-
lib/*.so
5-
lib/kdtree.bundle
6-
tmp
1+
*.bundle
2+
*.so
3+
/.tool-versions
4+
/Gemfile.lock
5+
/pkg/
6+
/tmp/

README.md

+10-10
Original file line numberDiff line numberDiff line change
@@ -54,17 +54,17 @@ kd2 = File.open("treefile") { |f| Kdtree.new(f) }
5454

5555
### Performance
5656

57-
Kdtree is fast. How fast? Using a tree with 1 million points on my i5 2.8ghz:
57+
Kdtree is fast. How fast? Using a tree with 1 million points on my M1:
5858

5959
```
60-
build (init) 3.52s
61-
nearest point 0.000003s
62-
nearest 5 points 0.000004s
63-
nearest 50 points 0.000014s
64-
nearest 255 points 0.000063s
65-
66-
persist 0.301963s
67-
read (init) 0.432676s
60+
build (init) 0.96s
61+
persist 0.000814s
62+
read (init) 0.009236s
63+
64+
nearest point 0.000002s
65+
nearest 5 points 0.000002s
66+
nearest 50 points 0.000006s
67+
nearest 255 points 0.000026s
6868
```
6969

7070
### Limitations
@@ -85,7 +85,7 @@ Since this gem was originally released, several folks have contributed important
8585

8686
### Changelog
8787

88-
Note: This gem is stable, maintained and continues to work great with all modern versions of Ruby MRI. Our CI tests through Ruby 2.7. No need for new releases until something breaks!
88+
Note: This gem is stable, maintained and continues to work great with all modern versions of Ruby MRI. Our CI tests through Ruby 3.4. No need for new releases until something breaks!
8989

9090
#### 0.5 - May 2025
9191

Rakefile

+2-12
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,12 @@
1-
require "bundler/setup"
1+
require "bundler/gem_tasks"
22
require "rake/extensiontask"
33
require "rake/testtask"
4-
require "bundler"
5-
Bundler::GemHelper.install_tasks
6-
7-
#
8-
# rake-compiler
9-
#
104

115
Rake::ExtensionTask.new("kdtree")
12-
13-
#
14-
# testing
15-
#
6+
task test: :compile
167

178
Rake::TestTask.new do
189
_1.libs << "test"
1910
_1.test_files = FileList["test/**/test_*.rb"]
2011
end
21-
task test: :compile
2212
task default: :test

justfile

+27-7
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,49 @@
11
default: test
22

3+
#
4+
# ci/test
5+
#
6+
37
# check repo - lint & test
48
check: lint test
59

610
# for ci. don't bother linting on windows
711
ci:
812
@just test
913

10-
# format with rubocop
11-
format: (lint "-a")
14+
# run tests
15+
test *ARGS:
16+
@just _banner rake test {{ARGS}}
17+
@bundle exec rake test {{ARGS}}
18+
19+
#
20+
# build/release
21+
#
22+
23+
clean:
24+
rm -rf pkg tmp lib/*.bundle lib/*.so
25+
26+
gem-build: check clean
27+
@just _banner rake build...
28+
@bundle exec rake build
1229

1330
# this will tag, build and push to rubygems
14-
gem-push: check
31+
gem-push: check clean
1532
@just _banner rake release...
1633
rake release
1734

35+
#
36+
# lint
37+
#
38+
39+
# format with rubocop
40+
format: (lint "-a")
41+
1842
# lint with rubocop
1943
lint *ARGS:
2044
@just _banner lint...
2145
bundle exec rubocop {{ARGS}}
2246

23-
# run tests
24-
test *ARGS:
25-
@just _banner rake test {{ARGS}}
26-
@bundle exec rake test {{ARGS}}
2747

2848
#
2949
# util

kdtree.gemspec

+9-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,15 @@ Gem::Specification.new do |s|
1919
"source_code_uri" => s.homepage,
2020
}
2121

22-
s.files = `git ls-files`.split("\n")
22+
s.files = %w[
23+
ext/kdtree/extconf.rb
24+
ext/kdtree/kdtree.c
25+
kdtree.gemspec
26+
lib/kdtree.rb
27+
LICENSE
28+
README.md
29+
]
30+
2331
s.extensions = ["ext/kdtree/extconf.rb"]
2432
s.require_paths = ["lib"]
2533
end

test/test_kdtree.rb

+5-1
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,11 @@ def dont_test_speed
9696
sizes.each do |s|
9797
points = (0...s).map { |i| [rand_coord, rand_coord, i] }
9898

99+
puts
100+
puts "x" * 72
101+
puts "x with #{s} points"
102+
puts "x" * 72
103+
99104
# build
100105
Benchmark.bm(17) do |bm|
101106
kdtree = nil
@@ -121,7 +126,6 @@ def dont_test_speed
121126
end
122127
end
123128
end
124-
puts
125129
end
126130
end
127131

0 commit comments

Comments
 (0)