datafusion-contrib / datafusion-functions-json

JSON / JSONB support for DataFusion (unofficial)
https://crates.io/crates/datafusion-functions-json
Apache License 2.0
13 stars 5 forks source link

json_find: make implementation much shorter #18

Closed davidhewitt closed 1 week ago

davidhewitt commented 1 week ago

This rewrites jiter_json_find to avoid function calls and instead use tight loops to descend the state. Hopefully a win for both simplicity and performance.

davidhewitt commented 1 week ago

It would probably be good to add some benchmarks before we go too much further, but I guess that can wait until after this.

davidhewitt commented 1 week ago

I pushed a starting point for some benchmarks.

When comparing against main, these show a slight improvement from this branch:

json_contains           time:   [39.840 ns 40.145 ns 40.469 ns]
                        change: [-6.1430% -5.1358% -4.1790%] (p = 0.00 < 0.05)
                        Performance has improved.

json_get_str            time:   [55.527 ns 55.875 ns 56.233 ns]
                        change: [-3.8639% -2.8376% -1.6959%] (p = 0.00 < 0.05)
                        Performance has improved.
Found 6 outliers among 100 measurements (6.00%)
  3 (3.00%) high mild
  3 (3.00%) high severe
samuelcolvin commented 1 week ago

Great!