Hi, I am Hari!
While understanding Blaze and experimenting with the validation performance of the JSON Schema CLI (as it is built upon Blaze), I was using --benchmark to compare different schemas and understand how the validation cost changes as more keywords and structures are introduced.
The benchmark is useful for telling me how much time the complete validation takes, but it does not tell me what part of the validation is responsible for that time. So I had to create many small schemas and instances to isolate individual pieces of functionality and measure the difference between them.
Because of this, I thought we could have the CLI provide an option like:
jsonschema validate schema.json instance.json --profile
The idea would not necessarily be to implement a profiler inside the CLI. Instead, the option could provide a profiling-friendly execution path that works with external profilers such as Instruments on macOS or perf on Linux.
Conceptually, the distinction I’m thinking about is:
- --benchmark → How long does validation take?
- --trace → What validation instructions are being executed?
- --profile → Where is the execution time being spent?
I noticed that Blaze already has contrib/validate.cc, which appears to provide a convenient way to run validation under an external profiler. So I’m wondering whether exposing a similar workflow through the CLI would be useful.
Also, I’m doing considerably more research into profiling than was probably necessary for this issue. So, if anyone is reading this and thinking about implementing it immediately, please don’t. It will make me sad.
Hi, I am Hari!
While understanding Blaze and experimenting with the validation performance of the JSON Schema CLI (as it is built upon Blaze), I was using --benchmark to compare different schemas and understand how the validation cost changes as more keywords and structures are introduced.
The benchmark is useful for telling me how much time the complete validation takes, but it does not tell me what part of the validation is responsible for that time. So I had to create many small schemas and instances to isolate individual pieces of functionality and measure the difference between them.
Because of this, I thought we could have the CLI provide an option like:
jsonschema validate schema.json instance.json --profile
The idea would not necessarily be to implement a profiler inside the CLI. Instead, the option could provide a profiling-friendly execution path that works with external profilers such as Instruments on macOS or perf on Linux.
Conceptually, the distinction I’m thinking about is:
I noticed that Blaze already has contrib/validate.cc, which appears to provide a convenient way to run validation under an external profiler. So I’m wondering whether exposing a similar workflow through the CLI would be useful.
Also, I’m doing considerably more research into profiling than was probably necessary for this issue. So, if anyone is reading this and thinking about implementing it immediately, please don’t. It will make me sad.