Skip to content

ValidationException performance cost #318

@rpolyano

Description

@rpolyano

Hello,

I'm using this library to validate elements against a large schema (https://www.hl7.org/fhir/downloads.html - https://www.hl7.org/fhir/fhir.schema.json.zip). We noticed a significant (almost 10x!) performance cost when using the validator in our program - mostly because our program has a large-ish stack (or maybe there is some other aspect, other than size of our stack that is causing problems, like asynchronicity) when it does validation, so java.lang.Throwable#fillInStackTrace takes a "long time" to run. Forking the code, and adding

@Override
public synchronized Throwable fillInStackTrace() {
  return this;
}

to ValidationException improves performance by almost 10x in our specific application.

Obviously this is not likely to be a good permanent solution (there are probably scenarios where the stack is useful) but being able to trigger this behaviour behind a flag or something would be ideal.

What do y'all think? Is this something we can optimize in the library, or maybe externally at the callsite?

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