|
| 1 | +import re |
| 2 | +import matplotlib.pyplot as plt |
| 3 | +import numpy as np |
| 4 | + |
| 5 | +data = open('cmake-build-release/out.txt').read() |
| 6 | + |
| 7 | +patterns = [ |
| 8 | + r"BM_(PSQL)/\w+\/?\w+?/(\w+)/\d+/min_warmup_time:20\.000\s+(\d+)\sns\s+\d+\sns\s+\d+", |
| 9 | + r"BM_(Doublets)/(\w+)/\w+\/?\w+?/(\w+)/\d+/min_warmup_time:20\.000\s+(\d+)\sns\s+\d+\sns\s+\d+", |
| 10 | +] |
| 11 | + |
| 12 | +PSQL_Transaction = [] |
| 13 | +PSQL_NonTransaction = [] |
| 14 | +Doublets_United_Volatile = [] |
| 15 | +Doublets_United_NonVolatile = [] |
| 16 | +Doublets_Split_Volatile = [] |
| 17 | +Doublets_Split_NonVolatile = [] |
| 18 | + |
| 19 | +for pattern in patterns: |
| 20 | + matches = re.findall(pattern, data) |
| 21 | + for match in matches: |
| 22 | + if match[0] == 'PSQL': |
| 23 | + _category, transaction, time = match |
| 24 | + if transaction == "Transaction": |
| 25 | + PSQL_Transaction.append(int(time)) |
| 26 | + else: |
| 27 | + PSQL_NonTransaction.append(int(time)) |
| 28 | + else: |
| 29 | + _category, trees, storage, time = match |
| 30 | + if trees == 'United': |
| 31 | + if storage == 'Volatile': |
| 32 | + Doublets_United_Volatile.append(int(time)) |
| 33 | + else: |
| 34 | + Doublets_United_NonVolatile.append(int(time)) |
| 35 | + else: |
| 36 | + if storage == 'Volatile': |
| 37 | + Doublets_Split_Volatile.append(int(time)) |
| 38 | + else: |
| 39 | + Doublets_Split_NonVolatile.append(int(time)) |
| 40 | + |
| 41 | +Doublets_United_Volatile = [max(1, x // 10000000) for x in Doublets_United_Volatile] |
| 42 | +Doublets_United_NonVolatile = [max(1, x // 10000000) for x in Doublets_United_NonVolatile] |
| 43 | +Doublets_Split_Volatile = [max(1, x // 10000000) for x in Doublets_Split_Volatile] |
| 44 | +Doublets_Split_NonVolatile = [max(1, x // 10000000) for x in Doublets_Split_NonVolatile] |
| 45 | +PSQL_NonTransaction = [max(1, x // 10000000) for x in PSQL_NonTransaction] |
| 46 | +PSQL_Transaction = [max(1, x // 10000000) for x in PSQL_Transaction] |
| 47 | + |
| 48 | +labels = ['Create', 'Delete', 'Each Identity', 'Each Concrete', 'Each Outgoing', 'Each Incoming', 'Each All', 'Update'] |
| 49 | +def bench1(): |
| 50 | + y = np.arange(len(labels)) |
| 51 | + |
| 52 | + width = 0.1 |
| 53 | + |
| 54 | + fig, ax = plt.subplots(figsize=(12, 8)) |
| 55 | + |
| 56 | + |
| 57 | + rects1 = ax.barh(y - 2*width, Doublets_United_Volatile, width, label='Doublets United Volatile', color='salmon') |
| 58 | + rects2 = ax.barh(y - width, Doublets_United_NonVolatile, width, label='Doublets United NonVolatile', color='red') |
| 59 | + |
| 60 | + rects3 = ax.barh(y, Doublets_Split_Volatile, width, label='Doublets Split Volatile', color='lightgreen') |
| 61 | + rects4 = ax.barh(y + width, Doublets_Split_NonVolatile, width, label='Doublets Split NonVolatile', color='green') |
| 62 | + |
| 63 | + rects5 = ax.barh(y + 2*width, PSQL_NonTransaction, width, label='PSQL NonTransaction', color='lightblue') |
| 64 | + rects6 = ax.barh(y + 3*width, PSQL_Transaction, width, label='PSQL Transaction', color='blue') |
| 65 | + |
| 66 | + ax.set_xlabel('Time (ns) - Scaled to Pixels') |
| 67 | + ax.set_title('Benchmark comparison for Doublets and BM_PSQL') |
| 68 | + ax.set_yticks(y) |
| 69 | + ax.set_yticklabels(labels) |
| 70 | + ax.legend() |
| 71 | + |
| 72 | + fig.tight_layout() |
| 73 | + |
| 74 | + plt.savefig("Bench1.png") |
| 75 | + plt.close(fig) |
| 76 | + |
| 77 | +def bench2(): |
| 78 | + y = np.arange(len(labels)) |
| 79 | + |
| 80 | + width = 0.1 |
| 81 | + fig, ax = plt.subplots(figsize=(12, 8)) |
| 82 | + |
| 83 | + rects1 = ax.barh(y - 2*width, Doublets_United_Volatile, width, label='Doublets United Volatile', color='salmon') |
| 84 | + rects2 = ax.barh(y - width, Doublets_United_NonVolatile, width, label='Doublets United NonVolatile', color='red') |
| 85 | + |
| 86 | + rects3 = ax.barh(y, Doublets_Split_Volatile, width, label='Doublets Split Volatile', color='lightgreen') |
| 87 | + rects4 = ax.barh(y + width, Doublets_Split_NonVolatile, width, label='Doublets Split NonVolatile', color='green') |
| 88 | + |
| 89 | + rects5 = ax.barh(y + 2*width, PSQL_NonTransaction, width, label='PSQL NonTransaction', color='lightblue') |
| 90 | + rects6 = ax.barh(y + 3*width, PSQL_Transaction, width, label='PSQL Transaction', color='blue') |
| 91 | + |
| 92 | + ax.set_xlabel('Time (ns) - Logarithmic Scale') |
| 93 | + ax.set_title('Benchmark comparison for Doublets and BM_PSQL') |
| 94 | + ax.set_yticks(y) |
| 95 | + ax.set_yticklabels(labels) |
| 96 | + ax.legend() |
| 97 | + |
| 98 | + ax.set_xscale('log') |
| 99 | + |
| 100 | + fig.tight_layout() |
| 101 | + |
| 102 | + plt.savefig("Bench2.png") |
| 103 | + plt.close(fig) |
| 104 | + |
| 105 | +bench1() |
| 106 | +bench2() |
0 commit comments