Skip to content

Commit e940306

Browse files
committed
Improve table readability
1 parent c9a8e54 commit e940306

2 files changed

Lines changed: 23 additions & 11 deletions

File tree

README.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -46,14 +46,14 @@ With the Jacobi method, the `np_vectorize` version is even faster than the refer
4646

4747
Finally, the `numba` version shows a comparable performance to the reference implementation, being slightly faster for Jacobi and slightly slower for Gauß-Seidel.
4848

49-
| variant | method | runtime_internal | runtime_total | runtime_internal_factor | runtime_total_factor |
50-
|----------------|-------------|--------------------|--------------------|-------------------------|----------------------|
51-
| `reference` | Gauß-Seidel | (0.563 ± 0.023) s | (0.567 ± 0.029) s | 100.00% | 100.00% |
52-
| `reference` | Jacobi | (0.490 ± 0.017) s | (0.493 ± 0.023) s | 100.00% | 100.00% |
53-
| `simple` | Gauß-Seidel | (51.817 ± 0.273) s | (52.107 ± 0.273) s | 9198.22% | 9195.29% |
54-
| `simple` | Jacobi | (52.287 ± 0.508) s | (52.250 ± 1.087) s | 10670.75% | 10591.22% |
55-
| `numba` | Gauß-Seidel | (0.703 ± 0.023) s | (1.150 ± 0.017) s | 124.85% | 202.94% |
56-
| `numba` | Jacobi | (0.417 ± 0.006) s | (0.860 ± 0.010) s | 85.03% | 174.32% |
57-
| `np_vectorize` | Gauß-Seidel | (55.177 ± 0.303) s | (55.467 ± 0.303) s | 9794.67% | 9788.24% |
58-
| `np_vectorize` | Jacobi | (0.213 ± 0.006) s | (0.497 ± 0.012) s | 43.54% | 100.68% |
49+
| variant | method | runtime_internal | | runtime_total | |
50+
|--------------|-------------|--------------------|-------------------------|--------------------|----------------------|
51+
| reference | Gauß-Seidel | (0.563 ± 0.023) s | 100.00% | (0.567 ± 0.029) s | 100.00% |
52+
| reference | Jacobi | (0.490 ± 0.017) s | 100.00% | (0.493 ± 0.023) s | 100.00% |
53+
| simple | Gauß-Seidel | (51.817 ± 0.273) s | 9198.22% | (52.107 ± 0.273) s | 9195.29% |
54+
| simple | Jacobi | (52.287 ± 0.508) s | 10670.75% | (52.250 ± 1.087) s | 10591.22% |
55+
| numba | Gauß-Seidel | (0.703 ± 0.023) s | 124.85% | (1.150 ± 0.017) s | 202.94% |
56+
| numba | Jacobi | (0.417 ± 0.006) s | 85.03% | (0.860 ± 0.010) s | 174.32% |
57+
| np_vectorize | Gauß-Seidel | (55.177 ± 0.303) s | 9794.67% | (55.467 ± 0.303) s | 9788.24% |
58+
| np_vectorize | Jacobi | (0.213 ± 0.006) s | 43.54% | (0.497 ± 0.012) s | 100.68% |
5959

benchmark/main.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,13 +70,25 @@ def format_ufloat_runtime(x) -> str:
7070
pl.col("runtime_internal_factor").map_elements(lambda x: f"{x:.2f}%", return_dtype=pl.String()),
7171
pl.col("runtime_total_factor").map_elements(lambda x: f"{x:.2f}%", return_dtype=pl.String()),
7272
)
73+
74+
df = df.select(
75+
pl.col("variant"),
76+
pl.col("method"),
77+
pl.col("runtime_internal"),
78+
pl.col("runtime_internal_factor"),
79+
pl.col("runtime_total"),
80+
pl.col("runtime_total_factor")
81+
)
7382

7483
with pl.Config(
7584
tbl_formatting="MARKDOWN",
7685
tbl_hide_column_data_types=True,
7786
tbl_hide_dataframe_shape=True,
7887
):
79-
print(df)
88+
s = str(df)
89+
for col in ("runtime_internal_factor", "runtime_total_factor"):
90+
s = s.replace(col, " " * len(col))
91+
print(s)
8092

8193

8294
if __name__ == "__main__":

0 commit comments

Comments
 (0)