Fokko commented on PR #7782:
URL: https://github.com/apache/iceberg/pull/7782#issuecomment-1679506371
I also did some benchmarking, and it is faster:
This branch:
```
➜ python git:(fd-bump-pydantic) ✗ hyperfine --warmup 1 "python3
tests/test_benchmark.py"
Benchmark 1: python3 tests/test_benchmark.py
Time (mean ± σ): 1.462 s ± 0.006 s [User: 1.433 s, System: 0.026
s]
Range (min … max): 1.454 s … 1.472 s 10 runs
```
Current master:
```
➜ python git:(master) ✗ hyperfine --warmup 1 "python3
tests/test_benchmark.py"
Benchmark 1: python3 tests/test_benchmark.py
Time (mean ± σ): 1.961 s ± 0.011 s [User: 1.933 s, System: 0.024
s]
Range (min … max): 1.944 s … 1.978 s 10 runs
```
This parses 10k json strings:
```python
import json
from pyiceberg.table.metadata import TableMetadataUtil
EXAMPLE_TABLE_METADATA_V2 = {
"format-version": 2,
"table-uuid": "9c12d441-03fe-4693-9a96-a0705ddf69c1",
"location": "s3://bucket/test/location",
"last-sequence-number": 34,
"last-updated-ms": 1602638573590,
"last-column-id": 3,
"current-schema-id": 1,
"schemas": [
{"type": "struct", "schema-id": 0, "fields": [{"id": 1, "name": "x",
"required": True, "type": "long"}]},
{
"type": "struct",
"schema-id": 1,
"identifier-field-ids": [1, 2],
"fields": [
{"id": 1, "name": "x", "required": True, "type": "long"},
{"id": 2, "name": "y", "required": True, "type": "long",
"doc": "comment"},
{"id": 3, "name": "z", "required": True, "type": "long"},
],
},
],
"default-spec-id": 0,
"partition-specs": [{"spec-id": 0, "fields": [{"name": "x", "transform":
"identity", "source-id": 1, "field-id": 1000}]}],
"last-partition-id": 1000,
"default-sort-order-id": 3,
"sort-orders": [
{
"order-id": 3,
"fields": [
{"transform": "identity", "source-id": 2, "direction":
"asc", "null-order": "nulls-first"},
{"transform": "bucket[4]", "source-id": 3, "direction":
"desc", "null-order": "nulls-last"},
],
}
],
"properties": {"read.split.target.size": "134217728"},
"current-snapshot-id": 3055729675574597004,
"snapshots": [
{
"snapshot-id": 3051729675574597004,
"timestamp-ms": 1515100955770,
"sequence-number": 0,
"summary": {"operation": "append"},
"manifest-list": "s3://a/b/1.avro",
},
{
"snapshot-id": 3055729675574597004,
"parent-snapshot-id": 3051729675574597004,
"timestamp-ms": 1555100955770,
"sequence-number": 1,
"summary": {"operation": "append"},
"manifest-list": "s3://a/b/2.avro",
"schema-id": 1,
},
],
"snapshot-log": [
{"snapshot-id": 3051729675574597004, "timestamp-ms": 1515100955770},
{"snapshot-id": 3055729675574597004, "timestamp-ms": 1555100955770},
],
"metadata-log": [{"metadata-file": "s3://bucket/.../v1.json",
"timestamp-ms": 1515100}],
"refs": {"test": {"snapshot-id": 3051729675574597004, "type": "tag",
"max-ref-age-ms": 10000000}},
}
metadata_v2 = json.dumps(EXAMPLE_TABLE_METADATA_V2)
for _ in range(10000):
TableMetadataUtil.parse_raw(metadata_v2)
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]