Skip to content

Commit

Permalink
Merge pull request #280 from gerlero/files
Browse files Browse the repository at this point in the history
Improve ASCII field parsing performance
  • Loading branch information
gerlero authored Nov 19, 2024
2 parents b76f74b + fa680f9 commit 65270ec
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 1 deletion.
Binary file modified benchmark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion foamlib/_files/_parsing.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ def _list_of(entry: ParserElement) -> ParserElement:
def _counted_tensor_list(
*, elsize: int = 1, ignore: Regex | None = None
) -> ParserElement:
float_pattern = r"(?i:[+-]?((\d+\.?\d*(e[+-]?\d+)?)|nan|inf(inity)?))"
float_pattern = r"(?i:[+-]?(?:(?:\d+\.?\d*(?:e[+-]?\d+)?)|nan|inf(?:inity)?))"
ignore_pattern = rf"(?:\s|{ignore.re.pattern})+" if ignore is not None else r"\s+"

if elsize == 1:
Expand Down

0 comments on commit 65270ec

Please sign in to comment.