Merge 'Add jsonb bench and rewrite jsonb parser to use slice and cursor' from Ihor Andrianov

Added bench to see how far i am from SQLite. If ~~Cloude~~ I did benches
correct moving from iterator to slice and cursor gives crazy performance
bump where we are almost on par with SLQLite when we are not talking
about huge jsons, but i suspect SQLite do some trickery there.

Closes #1125
This commit is contained in:
Pekka Enberg
2025-03-15 08:49:49 +02:00
4 changed files with 1238 additions and 442 deletions

View File

@@ -108,3 +108,7 @@ harness = false
[[bench]]
name = "mvcc_benchmark"
harness = false
[[bench]]
name = "json_benchmark"
harness = false

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

View File

@@ -75,7 +75,7 @@ pub fn get_json(json_value: &OwnedValue, indent: Option<&str>) -> crate::Result<
pub fn jsonb(json_value: &OwnedValue) -> crate::Result<OwnedValue> {
let jsonbin = match json_value {
OwnedValue::Null | OwnedValue::Integer(_) | OwnedValue::Float(_) | OwnedValue::Text(_) => {
Jsonb::from_str(&json_value.to_string())
Jsonb::from_str(&json_value.to_text().unwrap())
}
OwnedValue::Blob(blob) => {
let blob = Jsonb::new(blob.len(), Some(&blob));