|
| 1 | +import matplotlib.pyplot as plt |
| 2 | + |
| 3 | +# Data from the user |
| 4 | +processors = [ |
| 5 | + "AMD Ryzen 9 9950X3D", |
| 6 | + "Intel Core Ultra 9 285K", |
| 7 | + "Snapdragon X Elite X1E78100", |
| 8 | + "ARMv8 Neoverse-V2 72-Core" |
| 9 | +] |
| 10 | +gb_per_second = [13.64, 10.07, 4.27, 4.06] |
| 11 | + |
| 12 | + |
| 13 | +# Define colors for each processor type |
| 14 | +colors = ['#FF6F61', "#0655F1", '#2ECC71', '#2ECC71'] # AMD: coral, Intel: gray, ARM: green |
| 15 | + |
| 16 | +# Create bar chart |
| 17 | +plt.figure(figsize=(10, 6)) |
| 18 | +bars = plt.bar(processors, gb_per_second, color=colors, edgecolor='black') |
| 19 | + |
| 20 | +# Remove top and right spines |
| 21 | +ax = plt.gca() |
| 22 | +ax.spines['top'].set_visible(False) |
| 23 | +ax.spines['right'].set_visible(False) |
| 24 | + |
| 25 | +# Add data labels on top of each bar |
| 26 | +for bar in bars: |
| 27 | + yval = bar.get_height() |
| 28 | + plt.text(bar.get_x() + bar.get_width()/2, yval + 0.2, f'{yval:.2g} GB/s', |
| 29 | + ha='center', va='bottom', fontsize=14) |
| 30 | + |
| 31 | +plt.ylabel('Throughput (GB/s)', fontsize=14) |
| 32 | + |
| 33 | +# Add legend |
| 34 | +plt.legend(handles=[ |
| 35 | + plt.Rectangle((0,0),1,1,fc=colors[0],edgecolor='black'), |
| 36 | + plt.Rectangle((0,0),1,1,fc=colors[1],edgecolor='black'), |
| 37 | + plt.Rectangle((0,0),1,1,fc=colors[2],edgecolor='black') |
| 38 | +], labels=['AMD', 'Intel', 'ARM'], loc='upper right', fontsize=16, frameon=False) |
| 39 | +plt.tight_layout() |
| 40 | + |
| 41 | +# Save the plot as PNG |
| 42 | +plt.savefig('simdjson_benchmark.png', dpi=300, bbox_inches='tight') |
| 43 | +plt.close() |
0 commit comments