Skip to content

[Variant] Converting variant to JSON string seems slow #7869

@scovich

Description

@scovich

I added several timestamp markers (std::time::Instant::elapsed) to the test_json_to_variant_object_very_large test and ran with cargo test --release:

elapsed time (ms) delta (ms) finished step
5 5 generate data structures and json string
250 245 json_to_variant
593 343 Variant::try_new
1758 1165 variant_to_json_string
1839 81 build variant directly
2171 332 Variant::try_new
2758 587 JsonToVariantTest::run

We can build up the raw data structures and directly create a JSON string from them in 5ms, and parse the JSON string to a variant value in ~250ms, but it somehow takes 1.1 seconds to convert the resulting variant back to a string. Something seems wrong here.

Variant::try_new also seems quite slow (330-340 ms).

Metadata

Metadata

Assignees

No one assigned

    Labels

    parquetChanges to the parquet crate

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions