Format results as markdown table.
(results: Dict[str, Dict[str, Any]])
| 798 | |
| 799 | @staticmethod |
| 800 | def format_markdown(results: Dict[str, Dict[str, Any]]) -> str: |
| 801 | """Format results as markdown table.""" |
| 802 | lines = [] |
| 803 | lines.append("# Pickle Unpickling Benchmark Results\n") |
| 804 | |
| 805 | for size_key, tests in results.items(): |
| 806 | lines.append(f"## {size_key}\n") |
| 807 | lines.append("| Test | Type | Pickle Size (MB) | Time (ms) | Stdev (ms) | Peak Memory (MB) |") |
| 808 | lines.append("|------|------|------------------|-----------|------------|------------------|") |
| 809 | |
| 810 | for test_name, data in tests.items(): |
| 811 | lines.append( |
| 812 | f"| {data['test_name']} | " |
| 813 | f"{data['object_type']} | " |
| 814 | f"{data['pickle_size_mb']:.2f} | " |
| 815 | f"{data['time']['mean']*1000:.2f} | " |
| 816 | f"{data['time']['stdev']*1000:.2f} | " |
| 817 | f"{data['memory_peak_mb']:.2f} |" |
| 818 | ) |
| 819 | lines.append("") |
| 820 | |
| 821 | return "\n".join(lines) |
| 822 | |
| 823 | @staticmethod |
| 824 | def format_json(results: Dict[str, Dict[str, Any]]) -> str: |
no test coverage detected