-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathREADME
50 lines (29 loc) · 1.28 KB
/
README
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
Exploring Linear vs Binary Search
=================================
First, read this:
http://schani.wordpress.com/2010/04/30/linear-vs-binary-search/
To run the benchmarks, do
make
./bench.py >out
This will take a few hours and should run on an unloaded machine. The
results will be in the file "out".
You can then visualize the results with
./genplot.py <out
Note that by default the X-axis is logarithmic and the number shown is
the binary logarithm of what the actual array size is.
Usually you don't want the results for all the algorithms in one plot,
so you can select which ones you like via regular expressions:
./genplot.py 'binary.*' <out
This will only plot the results for the binary searches.
genplot.py knows lots of options and understands "--help".
To do just a single benchmarking run on one algorithm, use
"searchtest". It has two modes: test and benchmark.
In test mode, a search algorithm is tested for correctness:
./searchtest test <ALGORITHM> <MAX-N>
This will test the given algorithm on array sizes up to MAX-N.
To time an algorithm, use
time ./searchtest <NUM-SEARCHES> <ALGORITHM> <N>
This will run the given number of random searches with the given
algorithm on an array of size N.
To get a list of all the algorithms, do
./searchtest --list