Skip to content

Commit

Permalink
Kill redundant JsString allocation
Browse files Browse the repository at this point in the history
We don't need to create a JavaScript string object for property key.
  • Loading branch information
penberg committed Apr 16, 2024
1 parent 1968914 commit 91260fc
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions src/statement.rs
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,6 @@ fn convert_row(
.get_value(idx)
.or_else(|err| throw_libsql_error(cx, err))?;
let column_name = rows.column_name(idx).unwrap();
let key = cx.string(column_name);
let v: Handle<'_, JsValue> = match v {
libsql::Value::Null => cx.null().upcast(),
libsql::Value::Integer(v) => {
Expand All @@ -341,7 +340,7 @@ fn convert_row(
libsql::Value::Text(v) => cx.string(v).upcast(),
libsql::Value::Blob(v) => JsArrayBuffer::from_slice(cx, &v)?.upcast(),
};
result.set(cx, key, v)?;
result.set(cx, column_name, v)?;
}
Ok(())
}
Expand Down

0 comments on commit 91260fc

Please sign in to comment.