Speed » History » Version 28

Chris Cannam, 2014-05-21 03:33 PM

1 1 Chris Cannam
h1. Speed
2 1 Chris Cannam
3 7 Chris Cannam
h2. Aims
4 7 Chris Cannam
5 1 Chris Cannam
We want to make the plugin as fast as possible, but I think there's a case to be made for providing fast and slow modes (see [[Possibilities for Plugin Parameters]]).
6 1 Chris Cannam
7 1 Chris Cannam
In "fast" mode we should have the aim of producing a reasonable transcription in faster than real-time on any computer from the past 5 years or so. "Slow" mode has no particular speed constraint, simply as fast as possible an implementation of the best results we can easily do.
8 1 Chris Cannam
9 24 Chris Cannam
See the "timing":/projects/silvet/repository/show/testdata/timing directory in the repo for timing tests, summarised below. See the end of the results file, and "slower computers" below, for some figures from older hardware. Also included at the bottom are some evaluation metrics, just to verify that the different revisions don't actually produce different results.
10 1 Chris Cannam
11 1 Chris Cannam
h2. Work so far
12 20 Chris Cannam
13 20 Chris Cannam
Thinkpad T540p, 2-core+HT 64-bit Intel i5-4330M under 64-bit Linux.
14 1 Chris Cannam
15 6 Chris Cannam
 * commit:ce64d11ef336, pre-optimisation (release build) takes 104 seconds to process a 43.5-second file. (For reference, a debug build takes over 850 seconds.)
16 2 Chris Cannam
17 5 Chris Cannam
 * Experiments to test where the time is spent:
18 6 Chris Cannam
 ** commit:78a7bf247016 removing the unused Vamp plugin outputs: no more than 1% difference
19 6 Chris Cannam
 ** commit:f3bf6503e6c6 removing debug printouts: no more than 1% difference
20 5 Chris Cannam
 ** Adjusting the CQ resampler parameters to allow a lower SNR: no more than 1% difference
21 6 Chris Cannam
 ** commit:5314d3361dfb halving the number of EM iterations: reduces runtime by 43% (to 59 sec). If this is linear, then EM must be taking around 86% of the total.
22 5 Chris Cannam
23 1 Chris Cannam
 * Optimising EM:
24 6 Chris Cannam
 ** commit:97b77e7cb94c storing the templates as double instead of single-precision floats saves around 4% overall, for 100 sec
25 6 Chris Cannam
 ** (Alternatively, commit:840c0d703bbb storing them as floats and using single-precision arithmetic throughout saves around 14%, but presumably produces different results -- not pursued at this point)
26 6 Chris Cannam
 ** commit:19f6832fdc8a using bqvec library for raw vector allocation and manipulation instead of std::vector saves a further 10%, for 89 sec
27 5 Chris Cannam
 ** A couple of experiments to try to get the template arrays better aligned failed
28 6 Chris Cannam
 ** commit:6890dea115c3 factoring out a further loop saves another 11%, for 78 sec
29 5 Chris Cannam
30 5 Chris Cannam
 * Multi-threading:
31 6 Chris Cannam
 ** commit:df05f855f63b using OpenMP for the loop through columns when calling out to EM halves the runtime again (for 41s total), though now consuming 122s "user" time
32 6 Chris Cannam
 ** the same code with OMP_NUM_THREADS=1 now runs in 78 sec
33 8 Chris Cannam
34 9 Chris Cannam
That work was merged to default, for a new baseline time of 41s.
35 9 Chris Cannam
36 9 Chris Cannam
 * Optimising EM again:
37 1 Chris Cannam
 ** commit:f25b8e7de0ed not processing templates that are out of range for an instrument: saves 58% for 24 sec, or 41s single-threaded
38 27 Chris Cannam
 ** commit:d2bc51cc7f57 updated constant-Q implementation with slightly faster resampler settings: also 24 sec...
39 27 Chris Cannam
 ** commit:fc06b6f33021 converting EM from double to single-precision floats again: 19 sec
40 15 Chris Cannam
41 15 Chris Cannam
h2. Slower computers
42 15 Chris Cannam
43 21 Chris Cannam
Thinkpad T40p, single-core 32-bit 1.6GHz Pentium-M. This is almost a decade old and quite a lot slower than any reasonable target for real-time performance.
44 15 Chris Cannam
45 15 Chris Cannam
 * commit:ce64d11ef336 (104s on reference computer): 541 sec
46 23 Chris Cannam
 * commit:f25b8e7de0ed (24s on reference computer or 41s single-threaded): 415 sec (only 23% faster, or less than 11% of real-time speed)
47 23 Chris Cannam
 * commit:f25b8e7de0ed in draft mode (no shifts) (14s on reference computer): 210 sec (21% of real-time speed)
48 28 Chris Cannam
 * commit:8af9b6cd7451 in draft mode (6s on reference computer): 79 sec (55% of real-time speed)
49 28 Chris Cannam
50 23 Chris Cannam
51 1 Chris Cannam
h2. Other possibilities
52 8 Chris Cannam
53 25 Chris Cannam
 * Compare the quality of results using float arithmetic to those using doubles (update: see below)
54 1 Chris Cannam
 * Adaptively select the number of EM iterations -- if the process is converging more quickly, break off sooner (how to measure convergence?)
55 8 Chris Cannam
 * Optimise the constant-Q -- it wasn't a very significant part of the runtime to start with, but is presumably becoming more significant now
56 25 Chris Cannam
57 25 Chris Cannam
58 24 Chris Cannam
59 24 Chris Cannam
h2. Evaluation
60 24 Chris Cannam
61 24 Chris Cannam
For comparison,
62 24 Chris Cannam
63 24 Chris Cannam
Validating MIREX against ground truth at 50 ms:
64 24 Chris Cannam
precision 56.5, recall 68.3, accuracy 44.8, F 61.8
65 24 Chris Cannam
66 24 Chris Cannam
Validating MIREX against ground truth at 100 ms:
67 24 Chris Cannam
precision 65.5, recall 79.1, accuracy 55.9, F 71.7
68 24 Chris Cannam
69 24 Chris Cannam
Validating MIREX against ground truth at 150 ms:
70 24 Chris Cannam
precision 70.4, recall 85, accuracy 62.7, F 77
71 24 Chris Cannam
72 24 Chris Cannam
commit:ce64d11ef336
73 24 Chris Cannam
74 24 Chris Cannam
Validating against ground truth at 50 ms:
75 24 Chris Cannam
precision 34.9, recall 51.8, accuracy 26.3, F 41.7
76 24 Chris Cannam
77 24 Chris Cannam
Validating against MIREX submission at 50 ms:
78 24 Chris Cannam
precision 27.8, recall 34.1, accuracy 18.1, F 30.6
79 24 Chris Cannam
80 24 Chris Cannam
Validating against ground truth at 100 ms:
81 24 Chris Cannam
precision 49.5, recall 73.6, accuracy 42, F 59.2
82 24 Chris Cannam
83 24 Chris Cannam
Validating against MIREX submission at 100 ms:
84 24 Chris Cannam
precision 64.6, recall 79.4, accuracy 55.3, F 71.2
85 24 Chris Cannam
86 24 Chris Cannam
Validating against ground truth at 150 ms:
87 24 Chris Cannam
precision 52.7, recall 78.2, accuracy 45.9, F 63
88 24 Chris Cannam
89 24 Chris Cannam
Validating against MIREX submission at 150 ms:
90 24 Chris Cannam
precision 69.4, recall 85.3, accuracy 62, F 76.5
91 24 Chris Cannam
92 24 Chris Cannam
commit:f25b8e7de0ed
93 24 Chris Cannam
94 24 Chris Cannam
Validating against ground truth at 50 ms:
95 24 Chris Cannam
precision 33.8, recall 52.4, accuracy 25.9, F 41.1
96 24 Chris Cannam
97 24 Chris Cannam
Validating against MIREX submission at 50 ms:
98 24 Chris Cannam
precision 27, recall 34.7, accuracy 17.9, F 30.4
99 24 Chris Cannam
100 24 Chris Cannam
Validating against ground truth at 100 ms:
101 24 Chris Cannam
precision 47.8, recall 74.2, accuracy 41, F 58.2
102 24 Chris Cannam
103 24 Chris Cannam
Validating against MIREX submission at 100 ms:
104 24 Chris Cannam
precision 64.9, recall 83.2, accuracy 57.4, F 72.9
105 24 Chris Cannam
106 24 Chris Cannam
Validating against ground truth at 150 ms:
107 24 Chris Cannam
precision 50.7, recall 78.5, accuracy 44.5, F 61.6
108 24 Chris Cannam
109 24 Chris Cannam
Validating against MIREX submission at 150 ms:
110 24 Chris Cannam
precision 68.9, recall 88.4, accuracy 63.2, F 77.4
111 26 Chris Cannam
112 26 Chris Cannam
commit:840c0d703bbb (float processing in EM)
113 26 Chris Cannam
114 26 Chris Cannam
Validating against ground truth at 50 ms:
115 26 Chris Cannam
precision 34.1, recall 51.8, accuracy 25.9, F 41.1
116 26 Chris Cannam
117 26 Chris Cannam
Validating against MIREX submission at 50 ms:
118 26 Chris Cannam
precision 27.1, recall 34.1, accuracy 17.8, F 30.2
119 26 Chris Cannam
120 26 Chris Cannam
Validating against ground truth at 100 ms:
121 26 Chris Cannam
precision 48.4, recall 73.6, accuracy 41.2, F 58.4
122 26 Chris Cannam
123 26 Chris Cannam
Validating against MIREX submission at 100 ms:
124 26 Chris Cannam
precision 63.1, recall 79.4, accuracy 54.3, F 70.3
125 26 Chris Cannam
126 26 Chris Cannam
Validating against ground truth at 150 ms:
127 26 Chris Cannam
precision 51.5, recall 78.2, accuracy 45, F 62.1
128 26 Chris Cannam
129 26 Chris Cannam
Validating against MIREX submission at 150 ms:
130 26 Chris Cannam
precision 67.8, recall 85.3, accuracy 60.8, F 75.6