Skip to content

Commit

Permalink
Shorten the error message in cases of incorrect parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
movermeyer committed Oct 16, 2023
1 parent a8357c0 commit 90543e8
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ Parsing a timestamp with no time zone information (e.g., ``2014-01-09T21:48:00``
+--------------------------------+-----------+-----------+-----------+----------+----------+----------+-------------------------------+--------------------------------------------------+
|udatetime |709 nsec |677 nsec |692 nsec |715 nsec |705 nsec |700 nsec |586 nsec |7.5x |
+--------------------------------+-----------+-----------+-----------+----------+----------+----------+-------------------------------+--------------------------------------------------+
|str2date |6.84 usec |5.8 usec |6.86 usec |6.6 usec |6.47 usec |6.89 usec |**Incorrect Result** (``None``)|72.5x |
|str2date |6.84 usec |5.8 usec |6.86 usec |6.6 usec |6.47 usec |6.89 usec ||72.5x |
+--------------------------------+-----------+-----------+-----------+----------+----------+----------+-------------------------------+--------------------------------------------------+
|iso8601utils |N/A |N/A |N/A |8.64 usec |8.69 usec |9.2 usec |11.2 usec |74.0x |
+--------------------------------+-----------+-----------+-----------+----------+----------+----------+-------------------------------+--------------------------------------------------+
Expand Down Expand Up @@ -142,7 +142,7 @@ Parsing a timestamp with time zone information (e.g., ``2014-01-09T21:48:00-05:3
+--------------------------------+-------------------------------+-------------------------------+-------------------------------+-------------------------------+-------------------------------+-------------------------------+-------------------------------+--------------------------------------------------+
|udatetime |828 nsec |785 nsec |805 nsec |811 nsec |798 nsec |816 nsec |768 nsec |7.8x |
+--------------------------------+-------------------------------+-------------------------------+-------------------------------+-------------------------------+-------------------------------+-------------------------------+-------------------------------+--------------------------------------------------+
|str2date |7.79 usec |6.86 usec |7.71 usec |7.77 usec |7.62 usec |8 usec |**Incorrect Result** (``None``)|73.6x |
|str2date |7.79 usec |6.86 usec |7.71 usec |7.77 usec |7.62 usec |8 usec ||73.6x |
+--------------------------------+-------------------------------+-------------------------------+-------------------------------+-------------------------------+-------------------------------+-------------------------------+-------------------------------+--------------------------------------------------+
|iso8601 |12.9 usec |11.6 usec |13.1 usec |12.4 usec |12.9 usec |12.6 usec |31.1 usec |121.7x |
+--------------------------------+-------------------------------+-------------------------------+-------------------------------+-------------------------------+-------------------------------+-------------------------------+-------------------------------+--------------------------------------------------+
Expand All @@ -164,7 +164,7 @@ Parsing a timestamp with time zone information (e.g., ``2014-01-09T21:48:00-05:3
+--------------------------------+-------------------------------+-------------------------------+-------------------------------+-------------------------------+-------------------------------+-------------------------------+-------------------------------+--------------------------------------------------+
|metomi-isodatetime |1.24 msec |1.33 msec |1.73 msec |1.73 msec |1.73 msec |1.86 msec |N/A |11719.3x |
+--------------------------------+-------------------------------+-------------------------------+-------------------------------+-------------------------------+-------------------------------+-------------------------------+-------------------------------+--------------------------------------------------+
|moment |**Incorrect Result** (``None``)|**Incorrect Result** (``None``)|**Incorrect Result** (``None``)|**Incorrect Result** (``None``)|**Incorrect Result** (``None``)|**Incorrect Result** (``None``)|N/A |2116377.5x |
|moment |❌ |❌ |❌ |❌ |❌ |❌ |N/A |2116377.5x |
+--------------------------------+-------------------------------+-------------------------------+-------------------------------+-------------------------------+-------------------------------+-------------------------------+-------------------------------+--------------------------------------------------+

ciso8601 takes 106 nsec, which is **1.9x faster than datetime (builtin)**, the next fastest Python 3.12 parser in this comparison.
Expand Down
2 changes: 1 addition & 1 deletion benchmarking/format_results.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def __str__(self):
if self.exception:
return f"Raised ``{self.exception}`` Exception"
elif not self.matched_expected:
return f"**Incorrect Result** (``{self.parsed_value}``)"
return "❌"
else:
return self.formatted_timing()

Expand Down

0 comments on commit 90543e8

Please sign in to comment.