.. raw:: html .. role:: red .. role:: blue .. role:: green .. role:: cyan .. role:: magenta .. role:: orange .. role:: brown .. _benchmarks: Intro ----- The benchmarks were done using two test files (for mdf version 3 and 4) of around 170MB. The files contain 183 data groups and a total of 36424 channels. *asamdf 2.6.0* was compared against *mdfreader 0.2.6* (latest versions from PyPI). *mdfreader* seems to be the most used Python package to handle MDF files, and it also supports both version 3 and 4 of the standard. The three benchmark cathegories are file open, file save and extracting the data for all channels inside the file(36424 calls). For each cathegory two aspect were noted: elapsed time and peak RAM usage. Dependencies ------------ You will need the following packages to be able to run the benchmark script * psutil * mdfreader Usage ----- Extract the test files from the archive. Run the module *bench.py* ( see --help option for available options ) x64 Python results ------------------ Benchmark environment * 3.6.2 (v3.6.2:5fd33b5, Jul 8 2017, 04:57:36) [MSC v.1900 64 bit (AMD64)] * Windows-10-10.0.14393-SP0 * Intel64 Family 6 Model 94 Stepping 3, GenuineIntel * 16GB installed RAM Notations used in the results * nodata = asammdf MDF object created with load_measured_data=False (raw channel data not loaded into RAM) * compression = mdfreader mdf object created with compression=blosc * compression bcolz 6 = mdfreader mdf object created with compression=6 * noDataLoading = mdfreader mdf object read with noDataLoading=True Files used for benchmark: * 183 groups * 36424 channels Raw data ^^^^^^^^ ================================================== ========= ======== Open file Time [ms] RAM [MB] ================================================== ========= ======== asammdf 2.6.0 mdfv3 780 364 asammdf 2.6.0 nodata mdfv3 562 187 mdfreader 0.2.6 mdfv3 2825 545 mdfreader 0.2.6 compression mdfv3 4198 268 mdfreader 0.2.6 compression bcolz 6 mdfv3 4041 1040 mdfreader 0.2.6 noDataLoading mdfv3 1466 198 asammdf 2.6.0 mdfv4 1717 435 asammdf 2.6.0 nodata mdfv4 1351 244 mdfreader 0.2.6 mdfv4 5589 1308 mdfreader 0.2.6 compression mdfv4 6794 1023 mdfreader 0.2.6 compression bcolz 6 mdfv4 6853 1747 mdfreader 0.2.6 noDataLoading mdfv4 4035 943 ================================================== ========= ======== ================================================== ========= ======== Save file Time [ms] RAM [MB] ================================================== ========= ======== asammdf 2.6.0 mdfv3 392 365 asammdf 2.6.0 nodata mdfv3 421 195 mdfreader 0.2.6 mdfv3 8355 577 mdfreader 0.2.6 noDataLoading mdfv3 1159 370 mdfreader 0.2.6 compression mdfv3 8510 543 mdfreader 0.2.6 compression bcolz 6 mdfv3 8150 1041 asammdf 2.6.0 mdfv4 438 441 asammdf 2.6.0 nodata mdfv4 479 255 mdfreader 0.2.6 mdfv4 6491 1329 mdfreader 0.2.6 noDataLoading mdfv4 1142 1117 mdfreader 0.2.6 compression mdfv4 6637 1288 mdfreader 0.2.6 compression bcolz 6 mdfv4 6349 1764 ================================================== ========= ======== ================================================== ========= ======== Get all channels (36424 calls) Time [ms] RAM [MB] ================================================== ========= ======== asammdf 2.6.0 mdfv3 601 373 asammdf 2.6.0 nodata mdfv3 9213 203 mdfreader 0.2.6 mdfv3 71 545 mdfreader 0.2.6 noDataLoading mdfv3 18000000 198 mdfreader 0.2.6 compression mdfv3 663 272 mdfreader 0.2.6 compression bcolz 6 mdfv3 275 1041 asammdf 2.6.0 mdfv4 650 443 asammdf 2.6.0 nodata mdfv4 13256 257 mdfreader 0.2.6 mdfv4 63 1307 mdfreader 0.2.6 noDataLoading mdfv4 18000000 943 mdfreader 0.2.6 compression mdfv4 657 1031 mdfreader 0.2.6 compression bcolz 6 mdfv4 292 1754 ================================================== ========= ======== ================================================== ========= ======== Convert file Time [ms] RAM [MB] ================================================== ========= ======== asammdf 2.6.0 v3 to v4 4658 832 asammdf 2.6.0 v3 to v4 nodata 22138 578 asammdf 2.6.0 v4 to v3 5026 838 asammdf 2.6.0 v4 to v3 nodata 26169 723 ================================================== ========= ======== ================================================== ========= ======== Merge files Time [ms] RAM [MB] ================================================== ========= ======== asammdf 2.6.0 v3 10739 1390 asammdf 2.6.0 v3 nodata 31730 478 asammdf 2.6.0 v4 13171 1482 asammdf 2.6.0 v4 nodata 43173 545 ================================================== ========= ======== Graphical results ^^^^^^^^^^^^^^^^^ .. plot:: import matplotlib.pyplot as plt import numpy as np res = '../benchmarks/results/x64_asammdf_2.6.0_mdfreader_0.2.6.txt' topic = 'Open' aspect = 'time' for_doc = True with open(res, 'r') as f: lines = f.readlines() platform = 'x86' if '32 bit' in lines[2] else 'x64' idx = [i for i, line in enumerate(lines) if line.startswith('==')] table_spans = {'open': [idx[1] + 1, idx[2]], 'save': [idx[4] + 1, idx[5]], 'get': [idx[7] + 1, idx[8]], 'convert' : [idx[10] + 1, idx[11]], 'merge' : [idx[13] + 1, idx[14]]} start, stop = table_spans[topic.lower()] cat = [l[:50].strip() for l in lines[start: stop]] time = np.array([int(l[50:61].strip()) for l in lines[start: stop]]) ram = np.array([int(l[61:].strip()) for l in lines[start: stop]]) arr = ram if aspect == 'ram' else time y_pos = list(range(len(cat))) fig, ax = plt.subplots() fig.set_size_inches(9, 3.4 / 12 * len(cat) + 1.2) asam_pos = [i for i, c in enumerate(cat) if c.startswith('asam')] mdfreader_pos = [i for i, c in enumerate(cat) if c.startswith('mdfreader')] ax.barh(asam_pos, arr[asam_pos], color='green', ecolor='green') ax.barh(mdfreader_pos, arr[mdfreader_pos], color='blue', ecolor='black') ax.set_yticks(y_pos) ax.set_yticklabels(cat) ax.invert_yaxis() # labels read top-to-bottom ax.set_xlabel('Time [ms]' if aspect == 'time' else 'RAM [MB]') if topic == 'Get': ax.set_title('Get all channels (36424 calls) - {}'.format('time' if aspect == 'time' else 'ram usage')) else: ax.set_title('{} test file - {}'.format(topic, 'time' if aspect == 'time' else 'ram usage')) ax.xaxis.grid() fig.subplots_adjust(bottom=0.72/fig.get_figheight(), top=1-0.48/fig.get_figheight(), left=0.4, right=0.9) if aspect == 'time': if topic == 'Get': name = '{}_get_all_channels.png'.format(platform) else: name = '{}_{}.png'.format(platform, topic.lower()) else: if topic == 'Get': name = '{}_get_all_channels_ram_usage.png'.format(platform) else: name = '{}_{}_ram_usage.png'.format(platform, topic.lower()) plt.show() .. plot:: import matplotlib.pyplot as plt import numpy as np res = '../benchmarks/results/x64_asammdf_2.6.0_mdfreader_0.2.6.txt' topic = 'Open' aspect = 'ram' for_doc = True with open(res, 'r') as f: lines = f.readlines() platform = 'x86' if '32 bit' in lines[2] else 'x64' idx = [i for i, line in enumerate(lines) if line.startswith('==')] table_spans = {'open': [idx[1] + 1, idx[2]], 'save': [idx[4] + 1, idx[5]], 'get': [idx[7] + 1, idx[8]], 'convert' : [idx[10] + 1, idx[11]], 'merge' : [idx[13] + 1, idx[14]]} start, stop = table_spans[topic.lower()] cat = [l[:50].strip() for l in lines[start: stop]] time = np.array([int(l[50:61].strip()) for l in lines[start: stop]]) ram = np.array([int(l[61:].strip()) for l in lines[start: stop]]) if aspect == 'ram': arr = ram else: arr = time y_pos = list(range(len(cat))) fig, ax = plt.subplots() fig.set_size_inches(9, 3.4 / 12 * len(cat) + 1.2) asam_pos = [i for i, c in enumerate(cat) if c.startswith('asam')] mdfreader_pos = [i for i, c in enumerate(cat) if c.startswith('mdfreader')] ax.barh(asam_pos, arr[asam_pos], color='green', ecolor='green') ax.barh(mdfreader_pos, arr[mdfreader_pos], color='blue', ecolor='black') ax.set_yticks(y_pos) ax.set_yticklabels(cat) ax.invert_yaxis() # labels read top-to-bottom ax.set_xlabel('Time [ms]' if aspect == 'time' else 'RAM [MB]') if topic == 'Get': ax.set_title('Get all channels (36424 calls) - {}'.format('time' if aspect == 'time' else 'ram usage')) else: ax.set_title('{} test file - {}'.format(topic, 'time' if aspect == 'time' else 'ram usage')) ax.xaxis.grid() fig.subplots_adjust(bottom=0.72/fig.get_figheight(), top=1-0.48/fig.get_figheight(), left=0.4, right=0.9) if aspect == 'time': if topic == 'Get': name = '{}_get_all_channels.png'.format(platform) else: name = '{}_{}.png'.format(platform, topic.lower()) else: if topic == 'Get': name = '{}_get_all_channels_ram_usage.png'.format(platform) else: name = '{}_{}_ram_usage.png'.format(platform, topic.lower()) plt.show() .. plot:: import matplotlib.pyplot as plt import numpy as np res = '../benchmarks/results/x64_asammdf_2.6.0_mdfreader_0.2.6.txt' topic = 'Save' aspect = 'time' for_doc = True with open(res, 'r') as f: lines = f.readlines() platform = 'x86' if '32 bit' in lines[2] else 'x64' idx = [i for i, line in enumerate(lines) if line.startswith('==')] table_spans = {'open': [idx[1] + 1, idx[2]], 'save': [idx[4] + 1, idx[5]], 'get': [idx[7] + 1, idx[8]], 'convert' : [idx[10] + 1, idx[11]], 'merge' : [idx[13] + 1, idx[14]]} start, stop = table_spans[topic.lower()] cat = [l[:50].strip() for l in lines[start: stop]] time = np.array([int(l[50:61].strip()) for l in lines[start: stop]]) ram = np.array([int(l[61:].strip()) for l in lines[start: stop]]) if aspect == 'ram': arr = ram else: arr = time y_pos = list(range(len(cat))) fig, ax = plt.subplots() fig.set_size_inches(9, 3.4 / 12 * len(cat) + 1.2) asam_pos = [i for i, c in enumerate(cat) if c.startswith('asam')] mdfreader_pos = [i for i, c in enumerate(cat) if c.startswith('mdfreader')] ax.barh(asam_pos, arr[asam_pos], color='green', ecolor='green') ax.barh(mdfreader_pos, arr[mdfreader_pos], color='blue', ecolor='black') ax.set_yticks(y_pos) ax.set_yticklabels(cat) ax.invert_yaxis() # labels read top-to-bottom ax.set_xlabel('Time [ms]' if aspect == 'time' else 'RAM [MB]') if topic == 'Get': ax.set_title('Get all channels (36424 calls) - {}'.format('time' if aspect == 'time' else 'ram usage')) else: ax.set_title('{} test file - {}'.format(topic, 'time' if aspect == 'time' else 'ram usage')) ax.xaxis.grid() fig.subplots_adjust(bottom=0.72/fig.get_figheight(), top=1-0.48/fig.get_figheight(), left=0.4, right=0.9) if aspect == 'time': if topic == 'Get': name = '{}_get_all_channels.png'.format(platform) else: name = '{}_{}.png'.format(platform, topic.lower()) else: if topic == 'Get': name = '{}_get_all_channels_ram_usage.png'.format(platform) else: name = '{}_{}_ram_usage.png'.format(platform, topic.lower()) plt.show() .. plot:: import matplotlib.pyplot as plt import numpy as np res = '../benchmarks/results/x64_asammdf_2.6.0_mdfreader_0.2.6.txt' topic = 'Save' aspect = 'ram' for_doc = True with open(res, 'r') as f: lines = f.readlines() platform = 'x86' if '32 bit' in lines[2] else 'x64' idx = [i for i, line in enumerate(lines) if line.startswith('==')] table_spans = {'open': [idx[1] + 1, idx[2]], 'save': [idx[4] + 1, idx[5]], 'get': [idx[7] + 1, idx[8]], 'convert' : [idx[10] + 1, idx[11]], 'merge' : [idx[13] + 1, idx[14]]} start, stop = table_spans[topic.lower()] cat = [l[:50].strip() for l in lines[start: stop]] time = np.array([int(l[50:61].strip()) for l in lines[start: stop]]) ram = np.array([int(l[61:].strip()) for l in lines[start: stop]]) if aspect == 'ram': arr = ram else: arr = time y_pos = list(range(len(cat))) fig, ax = plt.subplots() fig.set_size_inches(9, 3.4 / 12 * len(cat) + 1.2) asam_pos = [i for i, c in enumerate(cat) if c.startswith('asam')] mdfreader_pos = [i for i, c in enumerate(cat) if c.startswith('mdfreader')] ax.barh(asam_pos, arr[asam_pos], color='green', ecolor='green') ax.barh(mdfreader_pos, arr[mdfreader_pos], color='blue', ecolor='black') ax.set_yticks(y_pos) ax.set_yticklabels(cat) ax.invert_yaxis() # labels read top-to-bottom ax.set_xlabel('Time [ms]' if aspect == 'time' else 'RAM [MB]') if topic == 'Get': ax.set_title('Get all channels (36424 calls) - {}'.format('time' if aspect == 'time' else 'ram usage')) else: ax.set_title('{} test file - {}'.format(topic, 'time' if aspect == 'time' else 'ram usage')) ax.xaxis.grid() fig.subplots_adjust(bottom=0.72/fig.get_figheight(), top=1-0.48/fig.get_figheight(), left=0.4, right=0.9) if aspect == 'time': if topic == 'Get': name = '{}_get_all_channels.png'.format(platform) else: name = '{}_{}.png'.format(platform, topic.lower()) else: if topic == 'Get': name = '{}_get_all_channels_ram_usage.png'.format(platform) else: name = '{}_{}_ram_usage.png'.format(platform, topic.lower()) plt.show() .. plot:: import matplotlib.pyplot as plt import numpy as np res = '../benchmarks/results/x64_asammdf_2.6.0_mdfreader_0.2.6.txt' topic = 'Get' aspect = 'time' for_doc = True with open(res, 'r') as f: lines = f.readlines() platform = 'x86' if '32 bit' in lines[2] else 'x64' idx = [i for i, line in enumerate(lines) if line.startswith('==')] table_spans = {'open': [idx[1] + 1, idx[2]], 'save': [idx[4] + 1, idx[5]], 'get': [idx[7] + 1, idx[8]], 'convert' : [idx[10] + 1, idx[11]], 'merge' : [idx[13] + 1, idx[14]]} start, stop = table_spans[topic.lower()] cat = [l[:50].strip() for l in lines[start: stop]] time = np.array([int(l[50:61].strip()) for l in lines[start: stop]]) ram = np.array([int(l[61:].strip()) for l in lines[start: stop]]) if aspect == 'ram': arr = ram else: arr = time y_pos = list(range(len(cat))) fig, ax = plt.subplots() fig.set_size_inches(9, 3.4 / 12 * len(cat) + 1.2) asam_pos = [i for i, c in enumerate(cat) if c.startswith('asam')] mdfreader_pos = [i for i, c in enumerate(cat) if c.startswith('mdfreader')] ax.barh(asam_pos, arr[asam_pos], color='green', ecolor='green') ax.barh(mdfreader_pos, arr[mdfreader_pos], color='blue', ecolor='black') ax.set_yticks(y_pos) ax.set_yticklabels(cat) ax.invert_yaxis() # labels read top-to-bottom ax.set_xlabel('Time [ms]' if aspect == 'time' else 'RAM [MB]') if topic == 'Get': ax.set_title('Get all channels (36424 calls) - {}'.format('time' if aspect == 'time' else 'ram usage')) else: ax.set_title('{} test file - {}'.format(topic, 'time' if aspect == 'time' else 'ram usage')) ax.xaxis.grid() fig.subplots_adjust(bottom=0.72/fig.get_figheight(), top=1-0.48/fig.get_figheight(), left=0.4, right=0.9) if aspect == 'time': if topic == 'Get': name = '{}_get_all_channels.png'.format(platform) else: name = '{}_{}.png'.format(platform, topic.lower()) else: if topic == 'Get': name = '{}_get_all_channels_ram_usage.png'.format(platform) else: name = '{}_{}_ram_usage.png'.format(platform, topic.lower()) plt.show() .. plot:: import matplotlib.pyplot as plt import numpy as np res = '../benchmarks/results/x64_asammdf_2.6.0_mdfreader_0.2.6.txt' topic = 'Get' aspect = 'ram' for_doc = True with open(res, 'r') as f: lines = f.readlines() platform = 'x86' if '32 bit' in lines[2] else 'x64' idx = [i for i, line in enumerate(lines) if line.startswith('==')] table_spans = {'open': [idx[1] + 1, idx[2]], 'save': [idx[4] + 1, idx[5]], 'get': [idx[7] + 1, idx[8]], 'convert' : [idx[10] + 1, idx[11]], 'merge' : [idx[13] + 1, idx[14]]} start, stop = table_spans[topic.lower()] cat = [l[:50].strip() for l in lines[start: stop]] time = np.array([int(l[50:61].strip()) for l in lines[start: stop]]) ram = np.array([int(l[61:].strip()) for l in lines[start: stop]]) if aspect == 'ram': arr = ram else: arr = time y_pos = list(range(len(cat))) fig, ax = plt.subplots() fig.set_size_inches(9, 3.4 / 12 * len(cat) + 1.2) asam_pos = [i for i, c in enumerate(cat) if c.startswith('asam')] mdfreader_pos = [i for i, c in enumerate(cat) if c.startswith('mdfreader')] ax.barh(asam_pos, arr[asam_pos], color='green', ecolor='green') ax.barh(mdfreader_pos, arr[mdfreader_pos], color='blue', ecolor='black') ax.set_yticks(y_pos) ax.set_yticklabels(cat) ax.invert_yaxis() # labels read top-to-bottom ax.set_xlabel('Time [ms]' if aspect == 'time' else 'RAM [MB]') if topic == 'Get': ax.set_title('Get all channels (36424 calls) - {}'.format('time' if aspect == 'time' else 'ram usage')) else: ax.set_title('{} test file - {}'.format(topic, 'time' if aspect == 'time' else 'ram usage')) ax.xaxis.grid() fig.subplots_adjust(bottom=0.72/fig.get_figheight(), top=1-0.48/fig.get_figheight(), left=0.4, right=0.9) if aspect == 'time': if topic == 'Get': name = '{}_get_all_channels.png'.format(platform) else: name = '{}_{}.png'.format(platform, topic.lower()) else: if topic == 'Get': name = '{}_get_all_channels_ram_usage.png'.format(platform) else: name = '{}_{}_ram_usage.png'.format(platform, topic.lower()) plt.show() .. plot:: import matplotlib.pyplot as plt import numpy as np res = '../benchmarks/results/x64_asammdf_2.6.0_mdfreader_0.2.6.txt' topic = 'Convert' aspect = 'time' for_doc = True with open(res, 'r') as f: lines = f.readlines() platform = 'x86' if '32 bit' in lines[2] else 'x64' idx = [i for i, line in enumerate(lines) if line.startswith('==')] table_spans = {'open': [idx[1] + 1, idx[2]], 'save': [idx[4] + 1, idx[5]], 'get': [idx[7] + 1, idx[8]], 'convert' : [idx[10] + 1, idx[11]], 'merge' : [idx[13] + 1, idx[14]]} start, stop = table_spans[topic.lower()] cat = [l[:50].strip() for l in lines[start: stop]] time = np.array([int(l[50:61].strip()) for l in lines[start: stop]]) ram = np.array([int(l[61:].strip()) for l in lines[start: stop]]) if aspect == 'ram': arr = ram else: arr = time y_pos = list(range(len(cat))) fig, ax = plt.subplots() fig.set_size_inches(9, 3.4 / 12 * len(cat) + 1.2) asam_pos = [i for i, c in enumerate(cat) if c.startswith('asam')] mdfreader_pos = [i for i, c in enumerate(cat) if c.startswith('mdfreader')] ax.barh(asam_pos, arr[asam_pos], color='green', ecolor='green') ax.barh(mdfreader_pos, arr[mdfreader_pos], color='blue', ecolor='black') ax.set_yticks(y_pos) ax.set_yticklabels(cat) ax.invert_yaxis() # labels read top-to-bottom ax.set_xlabel('Time [ms]' if aspect == 'time' else 'RAM [MB]') if topic == 'Get': ax.set_title('Get all channels (36424 calls) - {}'.format('time' if aspect == 'time' else 'ram usage')) else: ax.set_title('{} test file - {}'.format(topic, 'time' if aspect == 'time' else 'ram usage')) ax.xaxis.grid() fig.subplots_adjust(bottom=0.72/fig.get_figheight(), top=1-0.48/fig.get_figheight(), left=0.4, right=0.9) if aspect == 'time': if topic == 'Get': name = '{}_get_all_channels.png'.format(platform) else: name = '{}_{}.png'.format(platform, topic.lower()) else: if topic == 'Get': name = '{}_get_all_channels_ram_usage.png'.format(platform) else: name = '{}_{}_ram_usage.png'.format(platform, topic.lower()) plt.show() .. plot:: import matplotlib.pyplot as plt import numpy as np res = '../benchmarks/results/x64_asammdf_2.6.0_mdfreader_0.2.6.txt' topic = 'Convert' aspect = 'ram' for_doc = True with open(res, 'r') as f: lines = f.readlines() platform = 'x86' if '32 bit' in lines[2] else 'x64' idx = [i for i, line in enumerate(lines) if line.startswith('==')] table_spans = {'open': [idx[1] + 1, idx[2]], 'save': [idx[4] + 1, idx[5]], 'get': [idx[7] + 1, idx[8]], 'convert' : [idx[10] + 1, idx[11]], 'merge' : [idx[13] + 1, idx[14]]} start, stop = table_spans[topic.lower()] cat = [l[:50].strip() for l in lines[start: stop]] time = np.array([int(l[50:61].strip()) for l in lines[start: stop]]) ram = np.array([int(l[61:].strip()) for l in lines[start: stop]]) if aspect == 'ram': arr = ram else: arr = time y_pos = list(range(len(cat))) fig, ax = plt.subplots() fig.set_size_inches(9, 3.4 / 12 * len(cat) + 1.2) asam_pos = [i for i, c in enumerate(cat) if c.startswith('asam')] mdfreader_pos = [i for i, c in enumerate(cat) if c.startswith('mdfreader')] ax.barh(asam_pos, arr[asam_pos], color='green', ecolor='green') ax.barh(mdfreader_pos, arr[mdfreader_pos], color='blue', ecolor='black') ax.set_yticks(y_pos) ax.set_yticklabels(cat) ax.invert_yaxis() # labels read top-to-bottom ax.set_xlabel('Time [ms]' if aspect == 'time' else 'RAM [MB]') if topic == 'Get': ax.set_title('Get all channels (36424 calls) - {}'.format('time' if aspect == 'time' else 'ram usage')) else: ax.set_title('{} test file - {}'.format(topic, 'time' if aspect == 'time' else 'ram usage')) ax.xaxis.grid() fig.subplots_adjust(bottom=0.72/fig.get_figheight(), top=1-0.48/fig.get_figheight(), left=0.4, right=0.9) if aspect == 'time': if topic == 'Get': name = '{}_get_all_channels.png'.format(platform) else: name = '{}_{}.png'.format(platform, topic.lower()) else: if topic == 'Get': name = '{}_get_all_channels_ram_usage.png'.format(platform) else: name = '{}_{}_ram_usage.png'.format(platform, topic.lower()) plt.show() .. plot:: import matplotlib.pyplot as plt import numpy as np res = '../benchmarks/results/x64_asammdf_2.6.0_mdfreader_0.2.6.txt' topic = 'Merge' aspect = 'time' for_doc = True with open(res, 'r') as f: lines = f.readlines() platform = 'x86' if '32 bit' in lines[2] else 'x64' idx = [i for i, line in enumerate(lines) if line.startswith('==')] table_spans = {'open': [idx[1] + 1, idx[2]], 'save': [idx[4] + 1, idx[5]], 'get': [idx[7] + 1, idx[8]], 'convert' : [idx[10] + 1, idx[11]], 'merge' : [idx[13] + 1, idx[14]]} start, stop = table_spans[topic.lower()] cat = [l[:50].strip() for l in lines[start: stop]] time = np.array([int(l[50:61].strip()) for l in lines[start: stop]]) ram = np.array([int(l[61:].strip()) for l in lines[start: stop]]) if aspect == 'ram': arr = ram else: arr = time y_pos = list(range(len(cat))) fig, ax = plt.subplots() fig.set_size_inches(9, 3.4 / 12 * len(cat) + 1.2) asam_pos = [i for i, c in enumerate(cat) if c.startswith('asam')] mdfreader_pos = [i for i, c in enumerate(cat) if c.startswith('mdfreader')] ax.barh(asam_pos, arr[asam_pos], color='green', ecolor='green') ax.barh(mdfreader_pos, arr[mdfreader_pos], color='blue', ecolor='black') ax.set_yticks(y_pos) ax.set_yticklabels(cat) ax.invert_yaxis() # labels read top-to-bottom ax.set_xlabel('Time [ms]' if aspect == 'time' else 'RAM [MB]') if topic == 'Get': ax.set_title('Get all channels (36424 calls) - {}'.format('time' if aspect == 'time' else 'ram usage')) else: ax.set_title('{} test file - {}'.format(topic, 'time' if aspect == 'time' else 'ram usage')) ax.xaxis.grid() fig.subplots_adjust(bottom=0.72/fig.get_figheight(), top=1-0.48/fig.get_figheight(), left=0.4, right=0.9) if aspect == 'time': if topic == 'Get': name = '{}_get_all_channels.png'.format(platform) else: name = '{}_{}.png'.format(platform, topic.lower()) else: if topic == 'Get': name = '{}_get_all_channels_ram_usage.png'.format(platform) else: name = '{}_{}_ram_usage.png'.format(platform, topic.lower()) plt.show() .. plot:: import matplotlib.pyplot as plt import numpy as np res = '../benchmarks/results/x64_asammdf_2.6.0_mdfreader_0.2.6.txt' topic = 'Merge' aspect = 'ram' for_doc = True with open(res, 'r') as f: lines = f.readlines() platform = 'x86' if '32 bit' in lines[2] else 'x64' idx = [i for i, line in enumerate(lines) if line.startswith('==')] table_spans = {'open': [idx[1] + 1, idx[2]], 'save': [idx[4] + 1, idx[5]], 'get': [idx[7] + 1, idx[8]], 'convert' : [idx[10] + 1, idx[11]], 'merge' : [idx[13] + 1, idx[14]]} start, stop = table_spans[topic.lower()] cat = [l[:50].strip() for l in lines[start: stop]] time = np.array([int(l[50:61].strip()) for l in lines[start: stop]]) ram = np.array([int(l[61:].strip()) for l in lines[start: stop]]) if aspect == 'ram': arr = ram else: arr = time y_pos = list(range(len(cat))) fig, ax = plt.subplots() fig.set_size_inches(9, 3.4 / 12 * len(cat) + 1.2) asam_pos = [i for i, c in enumerate(cat) if c.startswith('asam')] mdfreader_pos = [i for i, c in enumerate(cat) if c.startswith('mdfreader')] ax.barh(asam_pos, arr[asam_pos], color='green', ecolor='green') ax.barh(mdfreader_pos, arr[mdfreader_pos], color='blue', ecolor='black') ax.set_yticks(y_pos) ax.set_yticklabels(cat) ax.invert_yaxis() # labels read top-to-bottom ax.set_xlabel('Time [ms]' if aspect == 'time' else 'RAM [MB]') if topic == 'Get': ax.set_title('Get all channels (36424 calls) - {}'.format('time' if aspect == 'time' else 'ram usage')) else: ax.set_title('{} test file - {}'.format(topic, 'time' if aspect == 'time' else 'ram usage')) ax.xaxis.grid() fig.subplots_adjust(bottom=0.72/fig.get_figheight(), top=1-0.48/fig.get_figheight(), left=0.4, right=0.9) if aspect == 'time': if topic == 'Get': name = '{}_get_all_channels.png'.format(platform) else: name = '{}_{}.png'.format(platform, topic.lower()) else: if topic == 'Get': name = '{}_get_all_channels_ram_usage.png'.format(platform) else: name = '{}_{}_ram_usage.png'.format(platform, topic.lower()) plt.show() x86 Python results ------------------ Benchmark environment * 3.6.1 (v3.6.1:69c0db5, Mar 21 2017, 17:54:52) [MSC v.1900 32 bit (Intel)] * Windows-10-10.0.14393-SP0 * Intel64 Family 6 Model 94 Stepping 3, GenuineIntel * 16GB installed RAM Notations used in the results * nodata = asammdf MDF object created with load_measured_data=False (raw channel data not loaded into RAM) * compression = mdfreader mdf object created with compression=blosc * compression bcolz 6 = mdfreader mdf object created with compression=6 * noDataLoading = mdfreader mdf object read with noDataLoading=True Files used for benchmark: * 183 groups * 36424 channels Raw data ^^^^^^^^ ================================================== ========= ======== Open file Time [ms] RAM [MB] ================================================== ========= ======== asammdf 2.6.0 mdfv3 888 287 asammdf 2.6.0 nodata mdfv3 609 118 mdfreader 0.2.6 mdfv3 3457 458 mdfreader 0.2.6 compression mdfv3 4665 184 mdfreader 0.2.6 compression bcolz 6 mdfv3 4619 940 mdfreader 0.2.6 noDataLoading mdfv3 1890 120 asammdf 2.6.0 mdfv4 1971 330 asammdf 2.6.0 nodata mdfv4 1630 150 mdfreader 0.2.6 mdfv4 6414 870 mdfreader 0.2.6 compression mdfv4 7495 587 mdfreader 0.2.6 compression bcolz 6 mdfv4 7473 1294 mdfreader 0.2.6 noDataLoading mdfv4 4418 523 ================================================== ========= ======== ================================================== ========= ======== Save file Time [ms] RAM [MB] ================================================== ========= ======== asammdf 2.6.0 mdfv3 450 290 asammdf 2.6.0 nodata mdfv3 457 125 mdfreader 0.2.6 mdfv3 9455 481 mdfreader 0.2.6 noDataLoading mdfv3 1314 289 mdfreader 0.2.6 compression mdfv3 9263 451 mdfreader 0.2.6 compression bcolz 6 mdfv3 9305 941 asammdf 2.6.0 mdfv4 617 334 asammdf 2.6.0 nodata mdfv4 601 159 mdfreader 0.2.6 mdfv4 7063 890 mdfreader 0.2.6 noDataLoading mdfv4 1452 694 mdfreader 0.2.6 compression mdfv4 7227 851 mdfreader 0.2.6 compression bcolz 6 mdfv4 6954 1312 ================================================== ========= ======== ================================================== ========= ======== Get all channels (36424 calls) Time [ms] RAM [MB] ================================================== ========= ======== asammdf 2.6.0 mdfv3 754 294 asammdf 2.6.0 nodata mdfv3 18843 130 mdfreader 0.2.6 mdfv3 80 458 mdfreader 0.2.6 noDataLoading mdfv3 18000000 118 mdfreader 0.2.6 compression mdfv3 690 188 mdfreader 0.2.6 compression bcolz 6 mdfv3 317 943 asammdf 2.6.0 mdfv4 784 335 asammdf 2.6.0 nodata mdfv4 20635 160 mdfreader 0.2.6 mdfv4 79 870 mdfreader 0.2.6 noDataLoading mdfv4 18000000 523 mdfreader 0.2.6 compression mdfv4 704 594 mdfreader 0.2.6 compression bcolz 6 mdfv4 333 1302 ================================================== ========= ======== ================================================== ========= ======== Convert file Time [ms] RAM [MB] ================================================== ========= ======== asammdf 2.6.0 v3 to v4 5720 679 asammdf 2.6.0 v3 to v4 nodata 28738 479 asammdf 2.6.0 v4 to v3 5731 682 asammdf 2.6.0 v4 to v3 nodata 30795 627 ================================================== ========= ======== ================================================== ========= ======== Merge files Time [ms] RAM [MB] ================================================== ========= ======== asammdf 2.6.0 v3 12988 1206 asammdf 2.6.0 v3 nodata 53020 322 asammdf 2.6.0 v4 15434 1244 asammdf 2.6.0 v4 nodata 60260 344 ================================================== ========= ======== Graphical results ^^^^^^^^^^^^^^^^^ .. plot:: import matplotlib.pyplot as plt import numpy as np res = '../benchmarks/results/x86_asammdf_2.6.0_mdfreader_0.2.6.txt' topic = 'Open' aspect = 'time' for_doc = True with open(res, 'r') as f: lines = f.readlines() platform = 'x86' if '32 bit' in lines[2] else 'x64' idx = [i for i, line in enumerate(lines) if line.startswith('==')] table_spans = {'open': [idx[1] + 1, idx[2]], 'save': [idx[4] + 1, idx[5]], 'get': [idx[7] + 1, idx[8]], 'convert' : [idx[10] + 1, idx[11]], 'merge' : [idx[13] + 1, idx[14]]} start, stop = table_spans[topic.lower()] cat = [l[:50].strip() for l in lines[start: stop]] time = np.array([int(l[50:61].strip()) for l in lines[start: stop]]) ram = np.array([int(l[61:].strip()) for l in lines[start: stop]]) if aspect == 'ram': arr = ram else: arr = time y_pos = list(range(len(cat))) fig, ax = plt.subplots() fig.set_size_inches(9, 3.4 / 12 * len(cat) + 1.2) asam_pos = [i for i, c in enumerate(cat) if c.startswith('asam')] mdfreader_pos = [i for i, c in enumerate(cat) if c.startswith('mdfreader')] ax.barh(asam_pos, arr[asam_pos], color='green', ecolor='green') ax.barh(mdfreader_pos, arr[mdfreader_pos], color='blue', ecolor='black') ax.set_yticks(y_pos) ax.set_yticklabels(cat) ax.invert_yaxis() # labels read top-to-bottom ax.set_xlabel('Time [ms]' if aspect == 'time' else 'RAM [MB]') if topic == 'Get': ax.set_title('Get all channels (36424 calls) - {}'.format('time' if aspect == 'time' else 'ram usage')) else: ax.set_title('{} test file - {}'.format(topic, 'time' if aspect == 'time' else 'ram usage')) ax.xaxis.grid() fig.subplots_adjust(bottom=0.72/fig.get_figheight(), top=1-0.48/fig.get_figheight(), left=0.4, right=0.9) if aspect == 'time': if topic == 'Get': name = '{}_get_all_channels.png'.format(platform) else: name = '{}_{}.png'.format(platform, topic.lower()) else: if topic == 'Get': name = '{}_get_all_channels_ram_usage.png'.format(platform) else: name = '{}_{}_ram_usage.png'.format(platform, topic.lower()) plt.show() .. plot:: import matplotlib.pyplot as plt import numpy as np res = '../benchmarks/results/x86_asammdf_2.6.0_mdfreader_0.2.6.txt' topic = 'Open' aspect = 'ram' for_doc = True with open(res, 'r') as f: lines = f.readlines() platform = 'x86' if '32 bit' in lines[2] else 'x64' idx = [i for i, line in enumerate(lines) if line.startswith('==')] table_spans = {'open': [idx[1] + 1, idx[2]], 'save': [idx[4] + 1, idx[5]], 'get': [idx[7] + 1, idx[8]], 'convert' : [idx[10] + 1, idx[11]], 'merge' : [idx[13] + 1, idx[14]]} start, stop = table_spans[topic.lower()] cat = [l[:50].strip() for l in lines[start: stop]] time = np.array([int(l[50:61].strip()) for l in lines[start: stop]]) ram = np.array([int(l[61:].strip()) for l in lines[start: stop]]) if aspect == 'ram': arr = ram else: arr = time y_pos = list(range(len(cat))) fig, ax = plt.subplots() fig.set_size_inches(9, 3.4 / 12 * len(cat) + 1.2) asam_pos = [i for i, c in enumerate(cat) if c.startswith('asam')] mdfreader_pos = [i for i, c in enumerate(cat) if c.startswith('mdfreader')] ax.barh(asam_pos, arr[asam_pos], color='green', ecolor='green') ax.barh(mdfreader_pos, arr[mdfreader_pos], color='blue', ecolor='black') ax.set_yticks(y_pos) ax.set_yticklabels(cat) ax.invert_yaxis() # labels read top-to-bottom ax.set_xlabel('Time [ms]' if aspect == 'time' else 'RAM [MB]') if topic == 'Get': ax.set_title('Get all channels (36424 calls) - {}'.format('time' if aspect == 'time' else 'ram usage')) else: ax.set_title('{} test file - {}'.format(topic, 'time' if aspect == 'time' else 'ram usage')) ax.xaxis.grid() fig.subplots_adjust(bottom=0.72/fig.get_figheight(), top=1-0.48/fig.get_figheight(), left=0.4, right=0.9) if aspect == 'time': if topic == 'Get': name = '{}_get_all_channels.png'.format(platform) else: name = '{}_{}.png'.format(platform, topic.lower()) else: if topic == 'Get': name = '{}_get_all_channels_ram_usage.png'.format(platform) else: name = '{}_{}_ram_usage.png'.format(platform, topic.lower()) plt.show() .. plot:: import matplotlib.pyplot as plt import numpy as np res = '../benchmarks/results/x86_asammdf_2.6.0_mdfreader_0.2.6.txt' topic = 'Save' aspect = 'time' for_doc = True with open(res, 'r') as f: lines = f.readlines() platform = 'x86' if '32 bit' in lines[2] else 'x64' idx = [i for i, line in enumerate(lines) if line.startswith('==')] table_spans = {'open': [idx[1] + 1, idx[2]], 'save': [idx[4] + 1, idx[5]], 'get': [idx[7] + 1, idx[8]], 'convert' : [idx[10] + 1, idx[11]], 'merge' : [idx[13] + 1, idx[14]]} start, stop = table_spans[topic.lower()] cat = [l[:50].strip() for l in lines[start: stop]] time = np.array([int(l[50:61].strip()) for l in lines[start: stop]]) ram = np.array([int(l[61:].strip()) for l in lines[start: stop]]) if aspect == 'ram': arr = ram else: arr = time y_pos = list(range(len(cat))) fig, ax = plt.subplots() fig.set_size_inches(9, 3.4 / 12 * len(cat) + 1.2) asam_pos = [i for i, c in enumerate(cat) if c.startswith('asam')] mdfreader_pos = [i for i, c in enumerate(cat) if c.startswith('mdfreader')] ax.barh(asam_pos, arr[asam_pos], color='green', ecolor='green') ax.barh(mdfreader_pos, arr[mdfreader_pos], color='blue', ecolor='black') ax.set_yticks(y_pos) ax.set_yticklabels(cat) ax.invert_yaxis() # labels read top-to-bottom ax.set_xlabel('Time [ms]' if aspect == 'time' else 'RAM [MB]') if topic == 'Get': ax.set_title('Get all channels (36424 calls) - {}'.format('time' if aspect == 'time' else 'ram usage')) else: ax.set_title('{} test file - {}'.format(topic, 'time' if aspect == 'time' else 'ram usage')) ax.xaxis.grid() fig.subplots_adjust(bottom=0.72/fig.get_figheight(), top=1-0.48/fig.get_figheight(), left=0.4, right=0.9) if aspect == 'time': if topic == 'Get': name = '{}_get_all_channels.png'.format(platform) else: name = '{}_{}.png'.format(platform, topic.lower()) else: if topic == 'Get': name = '{}_get_all_channels_ram_usage.png'.format(platform) else: name = '{}_{}_ram_usage.png'.format(platform, topic.lower()) plt.show() .. plot:: import matplotlib.pyplot as plt import numpy as np res = '../benchmarks/results/x86_asammdf_2.6.0_mdfreader_0.2.6.txt' topic = 'Save' aspect = 'ram' for_doc = True with open(res, 'r') as f: lines = f.readlines() platform = 'x86' if '32 bit' in lines[2] else 'x64' idx = [i for i, line in enumerate(lines) if line.startswith('==')] table_spans = {'open': [idx[1] + 1, idx[2]], 'save': [idx[4] + 1, idx[5]], 'get': [idx[7] + 1, idx[8]], 'convert' : [idx[10] + 1, idx[11]], 'merge' : [idx[13] + 1, idx[14]]} start, stop = table_spans[topic.lower()] cat = [l[:50].strip() for l in lines[start: stop]] time = np.array([int(l[50:61].strip()) for l in lines[start: stop]]) ram = np.array([int(l[61:].strip()) for l in lines[start: stop]]) if aspect == 'ram': arr = ram else: arr = time y_pos = list(range(len(cat))) fig, ax = plt.subplots() fig.set_size_inches(9, 3.4 / 12 * len(cat) + 1.2) asam_pos = [i for i, c in enumerate(cat) if c.startswith('asam')] mdfreader_pos = [i for i, c in enumerate(cat) if c.startswith('mdfreader')] ax.barh(asam_pos, arr[asam_pos], color='green', ecolor='green') ax.barh(mdfreader_pos, arr[mdfreader_pos], color='blue', ecolor='black') ax.set_yticks(y_pos) ax.set_yticklabels(cat) ax.invert_yaxis() # labels read top-to-bottom ax.set_xlabel('Time [ms]' if aspect == 'time' else 'RAM [MB]') if topic == 'Get': ax.set_title('Get all channels (36424 calls) - {}'.format('time' if aspect == 'time' else 'ram usage')) else: ax.set_title('{} test file - {}'.format(topic, 'time' if aspect == 'time' else 'ram usage')) ax.xaxis.grid() fig.subplots_adjust(bottom=0.72/fig.get_figheight(), top=1-0.48/fig.get_figheight(), left=0.4, right=0.9) if aspect == 'time': if topic == 'Get': name = '{}_get_all_channels.png'.format(platform) else: name = '{}_{}.png'.format(platform, topic.lower()) else: if topic == 'Get': name = '{}_get_all_channels_ram_usage.png'.format(platform) else: name = '{}_{}_ram_usage.png'.format(platform, topic.lower()) plt.show() .. plot:: import matplotlib.pyplot as plt import numpy as np res = '../benchmarks/results/x86_asammdf_2.6.0_mdfreader_0.2.6.txt' topic = 'Get' aspect = 'time' for_doc = True with open(res, 'r') as f: lines = f.readlines() platform = 'x86' if '32 bit' in lines[2] else 'x64' idx = [i for i, line in enumerate(lines) if line.startswith('==')] table_spans = {'open': [idx[1] + 1, idx[2]], 'save': [idx[4] + 1, idx[5]], 'get': [idx[7] + 1, idx[8]], 'convert' : [idx[10] + 1, idx[11]], 'merge' : [idx[13] + 1, idx[14]]} start, stop = table_spans[topic.lower()] cat = [l[:50].strip() for l in lines[start: stop]] time = np.array([int(l[50:61].strip()) for l in lines[start: stop]]) ram = np.array([int(l[61:].strip()) for l in lines[start: stop]]) if aspect == 'ram': arr = ram else: arr = time y_pos = list(range(len(cat))) fig, ax = plt.subplots() fig.set_size_inches(9, 3.4 / 12 * len(cat) + 1.2) asam_pos = [i for i, c in enumerate(cat) if c.startswith('asam')] mdfreader_pos = [i for i, c in enumerate(cat) if c.startswith('mdfreader')] ax.barh(asam_pos, arr[asam_pos], color='green', ecolor='green') ax.barh(mdfreader_pos, arr[mdfreader_pos], color='blue', ecolor='black') ax.set_yticks(y_pos) ax.set_yticklabels(cat) ax.invert_yaxis() # labels read top-to-bottom ax.set_xlabel('Time [ms]' if aspect == 'time' else 'RAM [MB]') if topic == 'Get': ax.set_title('Get all channels (36424 calls) - {}'.format('time' if aspect == 'time' else 'ram usage')) else: ax.set_title('{} test file - {}'.format(topic, 'time' if aspect == 'time' else 'ram usage')) ax.xaxis.grid() fig.subplots_adjust(bottom=0.72/fig.get_figheight(), top=1-0.48/fig.get_figheight(), left=0.4, right=0.9) if aspect == 'time': if topic == 'Get': name = '{}_get_all_channels.png'.format(platform) else: name = '{}_{}.png'.format(platform, topic.lower()) else: if topic == 'Get': name = '{}_get_all_channels_ram_usage.png'.format(platform) else: name = '{}_{}_ram_usage.png'.format(platform, topic.lower()) plt.show() .. plot:: import matplotlib.pyplot as plt import numpy as np res = '../benchmarks/results/x86_asammdf_2.6.0_mdfreader_0.2.6.txt' topic = 'Get' aspect = 'ram' for_doc = True with open(res, 'r') as f: lines = f.readlines() platform = 'x86' if '32 bit' in lines[2] else 'x64' idx = [i for i, line in enumerate(lines) if line.startswith('==')] table_spans = {'open': [idx[1] + 1, idx[2]], 'save': [idx[4] + 1, idx[5]], 'get': [idx[7] + 1, idx[8]], 'convert' : [idx[10] + 1, idx[11]], 'merge' : [idx[13] + 1, idx[14]]} start, stop = table_spans[topic.lower()] cat = [l[:50].strip() for l in lines[start: stop]] time = np.array([int(l[50:61].strip()) for l in lines[start: stop]]) ram = np.array([int(l[61:].strip()) for l in lines[start: stop]]) if aspect == 'ram': arr = ram else: arr = time y_pos = list(range(len(cat))) fig, ax = plt.subplots() fig.set_size_inches(9, 3.4 / 12 * len(cat) + 1.2) asam_pos = [i for i, c in enumerate(cat) if c.startswith('asam')] mdfreader_pos = [i for i, c in enumerate(cat) if c.startswith('mdfreader')] ax.barh(asam_pos, arr[asam_pos], color='green', ecolor='green') ax.barh(mdfreader_pos, arr[mdfreader_pos], color='blue', ecolor='black') ax.set_yticks(y_pos) ax.set_yticklabels(cat) ax.invert_yaxis() # labels read top-to-bottom ax.set_xlabel('Time [ms]' if aspect == 'time' else 'RAM [MB]') if topic == 'Get': ax.set_title('Get all channels (36424 calls) - {}'.format('time' if aspect == 'time' else 'ram usage')) else: ax.set_title('{} test file - {}'.format(topic, 'time' if aspect == 'time' else 'ram usage')) ax.xaxis.grid() fig.subplots_adjust(bottom=0.72/fig.get_figheight(), top=1-0.48/fig.get_figheight(), left=0.4, right=0.9) if aspect == 'time': if topic == 'Get': name = '{}_get_all_channels.png'.format(platform) else: name = '{}_{}.png'.format(platform, topic.lower()) else: if topic == 'Get': name = '{}_get_all_channels_ram_usage.png'.format(platform) else: name = '{}_{}_ram_usage.png'.format(platform, topic.lower()) plt.show() .. plot:: import matplotlib.pyplot as plt import numpy as np res = '../benchmarks/results/x86_asammdf_2.6.0_mdfreader_0.2.6.txt' topic = 'Convert' aspect = 'time' for_doc = True with open(res, 'r') as f: lines = f.readlines() platform = 'x86' if '32 bit' in lines[2] else 'x64' idx = [i for i, line in enumerate(lines) if line.startswith('==')] table_spans = {'open': [idx[1] + 1, idx[2]], 'save': [idx[4] + 1, idx[5]], 'get': [idx[7] + 1, idx[8]], 'convert' : [idx[10] + 1, idx[11]], 'merge' : [idx[13] + 1, idx[14]]} start, stop = table_spans[topic.lower()] cat = [l[:50].strip() for l in lines[start: stop]] time = np.array([int(l[50:61].strip()) for l in lines[start: stop]]) ram = np.array([int(l[61:].strip()) for l in lines[start: stop]]) if aspect == 'ram': arr = ram else: arr = time y_pos = list(range(len(cat))) fig, ax = plt.subplots() fig.set_size_inches(9, 3.4 / 12 * len(cat) + 1.2) asam_pos = [i for i, c in enumerate(cat) if c.startswith('asam')] mdfreader_pos = [i for i, c in enumerate(cat) if c.startswith('mdfreader')] ax.barh(asam_pos, arr[asam_pos], color='green', ecolor='green') ax.barh(mdfreader_pos, arr[mdfreader_pos], color='blue', ecolor='black') ax.set_yticks(y_pos) ax.set_yticklabels(cat) ax.invert_yaxis() # labels read top-to-bottom ax.set_xlabel('Time [ms]' if aspect == 'time' else 'RAM [MB]') if topic == 'Get': ax.set_title('Get all channels (36424 calls) - {}'.format('time' if aspect == 'time' else 'ram usage')) else: ax.set_title('{} test file - {}'.format(topic, 'time' if aspect == 'time' else 'ram usage')) ax.xaxis.grid() fig.subplots_adjust(bottom=0.72/fig.get_figheight(), top=1-0.48/fig.get_figheight(), left=0.4, right=0.9) if aspect == 'time': if topic == 'Get': name = '{}_get_all_channels.png'.format(platform) else: name = '{}_{}.png'.format(platform, topic.lower()) else: if topic == 'Get': name = '{}_get_all_channels_ram_usage.png'.format(platform) else: name = '{}_{}_ram_usage.png'.format(platform, topic.lower()) plt.show() .. plot:: import matplotlib.pyplot as plt import numpy as np res = '../benchmarks/results/x86_asammdf_2.6.0_mdfreader_0.2.6.txt' topic = 'Convert' aspect = 'ram' for_doc = True with open(res, 'r') as f: lines = f.readlines() platform = 'x86' if '32 bit' in lines[2] else 'x64' idx = [i for i, line in enumerate(lines) if line.startswith('==')] table_spans = {'open': [idx[1] + 1, idx[2]], 'save': [idx[4] + 1, idx[5]], 'get': [idx[7] + 1, idx[8]], 'convert' : [idx[10] + 1, idx[11]], 'merge' : [idx[13] + 1, idx[14]]} start, stop = table_spans[topic.lower()] cat = [l[:50].strip() for l in lines[start: stop]] time = np.array([int(l[50:61].strip()) for l in lines[start: stop]]) ram = np.array([int(l[61:].strip()) for l in lines[start: stop]]) if aspect == 'ram': arr = ram else: arr = time y_pos = list(range(len(cat))) fig, ax = plt.subplots() fig.set_size_inches(9, 3.4 / 12 * len(cat) + 1.2) asam_pos = [i for i, c in enumerate(cat) if c.startswith('asam')] mdfreader_pos = [i for i, c in enumerate(cat) if c.startswith('mdfreader')] ax.barh(asam_pos, arr[asam_pos], color='green', ecolor='green') ax.barh(mdfreader_pos, arr[mdfreader_pos], color='blue', ecolor='black') ax.set_yticks(y_pos) ax.set_yticklabels(cat) ax.invert_yaxis() # labels read top-to-bottom ax.set_xlabel('Time [ms]' if aspect == 'time' else 'RAM [MB]') if topic == 'Get': ax.set_title('Get all channels (36424 calls) - {}'.format('time' if aspect == 'time' else 'ram usage')) else: ax.set_title('{} test file - {}'.format(topic, 'time' if aspect == 'time' else 'ram usage')) ax.xaxis.grid() fig.subplots_adjust(bottom=0.72/fig.get_figheight(), top=1-0.48/fig.get_figheight(), left=0.4, right=0.9) if aspect == 'time': if topic == 'Get': name = '{}_get_all_channels.png'.format(platform) else: name = '{}_{}.png'.format(platform, topic.lower()) else: if topic == 'Get': name = '{}_get_all_channels_ram_usage.png'.format(platform) else: name = '{}_{}_ram_usage.png'.format(platform, topic.lower()) plt.show() .. plot:: import matplotlib.pyplot as plt import numpy as np res = '../benchmarks/results/x86_asammdf_2.6.0_mdfreader_0.2.6.txt' topic = 'Merge' aspect = 'time' for_doc = True with open(res, 'r') as f: lines = f.readlines() platform = 'x86' if '32 bit' in lines[2] else 'x64' idx = [i for i, line in enumerate(lines) if line.startswith('==')] table_spans = {'open': [idx[1] + 1, idx[2]], 'save': [idx[4] + 1, idx[5]], 'get': [idx[7] + 1, idx[8]], 'convert' : [idx[10] + 1, idx[11]], 'merge' : [idx[13] + 1, idx[14]]} start, stop = table_spans[topic.lower()] cat = [l[:50].strip() for l in lines[start: stop]] time = np.array([int(l[50:61].strip()) for l in lines[start: stop]]) ram = np.array([int(l[61:].strip()) for l in lines[start: stop]]) if aspect == 'ram': arr = ram else: arr = time y_pos = list(range(len(cat))) fig, ax = plt.subplots() fig.set_size_inches(9, 3.4 / 12 * len(cat) + 1.2) asam_pos = [i for i, c in enumerate(cat) if c.startswith('asam')] mdfreader_pos = [i for i, c in enumerate(cat) if c.startswith('mdfreader')] ax.barh(asam_pos, arr[asam_pos], color='green', ecolor='green') ax.barh(mdfreader_pos, arr[mdfreader_pos], color='blue', ecolor='black') ax.set_yticks(y_pos) ax.set_yticklabels(cat) ax.invert_yaxis() # labels read top-to-bottom ax.set_xlabel('Time [ms]' if aspect == 'time' else 'RAM [MB]') if topic == 'Get': ax.set_title('Get all channels (36424 calls) - {}'.format('time' if aspect == 'time' else 'ram usage')) else: ax.set_title('{} test file - {}'.format(topic, 'time' if aspect == 'time' else 'ram usage')) ax.xaxis.grid() fig.subplots_adjust(bottom=0.72/fig.get_figheight(), top=1-0.48/fig.get_figheight(), left=0.4, right=0.9) if aspect == 'time': if topic == 'Get': name = '{}_get_all_channels.png'.format(platform) else: name = '{}_{}.png'.format(platform, topic.lower()) else: if topic == 'Get': name = '{}_get_all_channels_ram_usage.png'.format(platform) else: name = '{}_{}_ram_usage.png'.format(platform, topic.lower()) plt.show() .. plot:: import matplotlib.pyplot as plt import numpy as np res = '../benchmarks/results/x86_asammdf_2.6.0_mdfreader_0.2.6.txt' topic = 'Merge' aspect = 'ram' for_doc = True with open(res, 'r') as f: lines = f.readlines() platform = 'x86' if '32 bit' in lines[2] else 'x64' idx = [i for i, line in enumerate(lines) if line.startswith('==')] table_spans = {'open': [idx[1] + 1, idx[2]], 'save': [idx[4] + 1, idx[5]], 'get': [idx[7] + 1, idx[8]], 'convert' : [idx[10] + 1, idx[11]], 'merge' : [idx[13] + 1, idx[14]]} start, stop = table_spans[topic.lower()] cat = [l[:50].strip() for l in lines[start: stop]] time = np.array([int(l[50:61].strip()) for l in lines[start: stop]]) ram = np.array([int(l[61:].strip()) for l in lines[start: stop]]) if aspect == 'ram': arr = ram else: arr = time y_pos = list(range(len(cat))) fig, ax = plt.subplots() fig.set_size_inches(9, 3.4 / 12 * len(cat) + 1.2) asam_pos = [i for i, c in enumerate(cat) if c.startswith('asam')] mdfreader_pos = [i for i, c in enumerate(cat) if c.startswith('mdfreader')] ax.barh(asam_pos, arr[asam_pos], color='green', ecolor='green') ax.barh(mdfreader_pos, arr[mdfreader_pos], color='blue', ecolor='black') ax.set_yticks(y_pos) ax.set_yticklabels(cat) ax.invert_yaxis() # labels read top-to-bottom ax.set_xlabel('Time [ms]' if aspect == 'time' else 'RAM [MB]') if topic == 'Get': ax.set_title('Get all channels (36424 calls) - {}'.format('time' if aspect == 'time' else 'ram usage')) else: ax.set_title('{} test file - {}'.format(topic, 'time' if aspect == 'time' else 'ram usage')) ax.xaxis.grid() fig.subplots_adjust(bottom=0.72/fig.get_figheight(), top=1-0.48/fig.get_figheight(), left=0.4, right=0.9) if aspect == 'time': if topic == 'Get': name = '{}_get_all_channels.png'.format(platform) else: name = '{}_{}.png'.format(platform, topic.lower()) else: if topic == 'Get': name = '{}_get_all_channels_ram_usage.png'.format(platform) else: name = '{}_{}_ram_usage.png'.format(platform, topic.lower()) plt.show()