Skip to content

Add caching to JSON schema builder #88

@implabinash

Description

@implabinash

Hi everyone,

I am Abinash. I found that the JSON schema validator have to build the schema every single time, you try to update or insert in your table.

jsonschema::is_valid(&schema.0, &instance.0)

So, I think, why not add a simple caching layer with a limit to make the schema check faster, because with a caching layer, if you insert or update millions of rows with the same JSON schema, you don't have to build the schema every single time.

Implementation can be done in a few lines of code with the help of the lru crate (https://crates.io/crates/lru). With this, the binary will only increase by 2-3%, i.e. around 50-100kb, but the performance will be doubled.

If the maintainers think this will be great for the company, I am happy to implement this feature.

Thank you.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions