-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
113 additions
and
74 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,34 @@ | ||
alias ElixirRtree.Node | ||
import IO.ANSI | ||
generate = fn n,s -> | ||
BoundingBoxGenerator.generate(n,s,[]) |> Enum.map(fn x -> {x,ElixirRtree.Node.new()} end) | ||
BoundingBoxGenerator.generate(n,s,[]) |> Enum.map(fn x -> {x,Node.new()} end) | ||
end | ||
|
||
new_tree = fn boxes,s -> | ||
boxes |> Enum.slice(0..s-1) |> Enum.reduce(Drtree.new,fn {b,i},acc -> | ||
acc |> ElixirRtree.insert({i,b}) | ||
acc |> Drtree.insert({i,b}) | ||
end) | ||
end | ||
|
||
boxes = generate.(100000,1) | ||
|
||
Benchee.run(%{ | ||
cyan() <>"tree "<> cyan() <>"["<> color(195) <>"1000 leafs"<> cyan() <>"]" <> reset() => | ||
{fn {t,b} -> | ||
ElixirRtree.query(t,b) | ||
"tree [1000 leafs]" => | ||
{fn {t,b} -> Drtree.query(t,b) | ||
end, | ||
before_scenario: fn b -> {new_tree.(boxes,1000),b} end}, | ||
cyan() <>"tree "<> cyan() <>"["<> color(195) <>"10000 leafs"<> cyan() <>"]" <> reset() => | ||
{fn {t,b} -> | ||
ElixirRtree.query(t,b) | ||
"tree [10000 leafs]" => | ||
{fn {t,b} -> Drtree.query(t,b) | ||
end, | ||
before_scenario: fn b -> {new_tree.(boxes,10000),b} end}, | ||
cyan() <>"tree "<> cyan() <>"["<> color(195) <>"100000 leafs"<> cyan() <>"]" <> reset() => | ||
{fn {t,b} -> | ||
ElixirRtree.query(t,b) | ||
"tree [100000 leafs]" => | ||
{fn {t,b} -> Drtree.query(t,b) | ||
end, | ||
before_scenario: fn b -> {new_tree.(boxes,100000),b} end}, | ||
|
||
}, inputs: %{ | ||
yellow() <> "1x1"<> cyan() <> " box query" => [{0,1},{0,1}], | ||
yellow() <> "10x10"<> cyan() <> " box query" => [{0,10},{0,10}], | ||
yellow() <> "100x100"<> cyan() <> " box query" => [{-50,50},{0,100}], | ||
yellow() <> "world"<> cyan() <> " box query" => [{-180,180},{-90,90}] | ||
yellow() <> "1x1"<> cyan() <> " box query" <> reset() => [{0,1},{0,1}], | ||
yellow() <> "10x10"<> cyan() <> " box query" <> reset() => [{0,10},{0,10}], | ||
yellow() <> "100x100"<> cyan() <> " box query" <> reset() => [{-50,50},{0,100}], | ||
yellow() <> "world"<> cyan() <> " box query" <> reset() => [{-180,180},{-90,90}] | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
echo "Insertion benchmark..." | ||
mix run bench/insert_benchmark.ex | ||
|
||
echo "Query benchmark..." | ||
mix run bench/query_benchmark.ex | ||
|
||
echo "Update benchmark..." | ||
mix run bench/update_benchmark.ex | ||
|
||
echo "Erase benchmark..." | ||
mix run bench/delete_benchmark.ex |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters