Skip to content

Commit 6e40b68

Browse files
authored
Merge pull request #586 from gerlero/readme
Update benchmark results
2 parents 32af9a1 + 129bad6 commit 6e40b68

File tree

4 files changed

+10
-4
lines changed

4 files changed

+10
-4
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
<div align="center">
2222
<img alt="benchmark" src="https://github.com/gerlero/foamlib/raw/main/benchmark/benchmark.png" height="250">
2323

24-
Parsing a `volVectorField` with 200k cells.<sup>[1](#benchmark)</sup>
24+
_Loading a_ volVectorField _with one million cells_<sup>[1](#benchmark)</sup>
2525
</div>
2626

2727

@@ -282,4 +282,4 @@ If you use **foamlib** in your research, please cite our paper:
282282

283283
## 👟 Footnotes
284284

285-
<a id="benchmark">[1]</a> foamlib 1.3.7 vs PyFoam 2023.7 on an M3 MacBook Air. [Benchmark script](https://github.com/gerlero/foamlib/blob/main/benchmark/benchmark.py).
285+
<a id="benchmark">[1]</a> foamlib 1.3.9 vs. PyFoam 2023.7 (Python 3.11.13) on an M3 MacBook Air. [Benchmark script](https://github.com/gerlero/foamlib/blob/main/benchmark/benchmark.py).

benchmark/benchmark.png

100755100644
30 KB
Loading

benchmark/benchmark.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,17 @@
77
from foamlib import FoamFieldFile
88
from PyFoam.RunDictionary.ParsedParameterFile import ParsedParameterFile
99

10-
FoamFieldFile("U").internal_field = [[0.0, 0.0, 0.0]] * 200_000
10+
FoamFieldFile("U").internal_field = [[0.0, 0.0, 0.0]] * 1_000_000
11+
with FoamFieldFile("U_binary") as f:
12+
f.format = "binary"
13+
f.internal_field = [[0.0, 0.0, 0.0]] * 1_000_000
1114

1215
print(
1316
f"foamlib: {min(timeit.repeat(lambda: FoamFieldFile('U').internal_field, number=1))} s"
1417
)
18+
print(
19+
f"foamlib (binary): {min(timeit.repeat(lambda: FoamFieldFile('U_binary').internal_field, number=1))} s"
20+
)
1521
print(
1622
f"PyFoam: {min(timeit.repeat(lambda: ParsedParameterFile('U')['internalField'], number=1))} s"
1723
)

benchmark/requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
foamlib==1.3.7
1+
foamlib==1.3.9
22
PyFoam==2023.7

0 commit comments

Comments
 (0)