diff options
author | Jared Beller <25756846+jbellerb@users.noreply.github.com> | 2021-02-13 11:56:56 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-02-13 11:56:56 -0500 |
commit | b50691efed482496e241857921b66b65bec61655 (patch) | |
tree | 63acea6b2e2b1ae9ca43585f22800cade8458e27 /core/examples/http_bench_json_ops.js | |
parent | af460fc464562566dc1534c0f61f53c2976b9bd7 (diff) |
refactor(core): Strongly typed deserialization of JSON ops (#9423)
This PR makes json_op_sync/async generic to all Deserialize/Serialize types
instead of the loosely-typed serde_json::Value. Since serde_json::Value
implements Deserialize/Serialize, very little existing code needs to be updated,
however as json_op_sync/async are now generic, type inference is broken in some
cases (see cli/build.rs:146). I've found this reduces a good bit of boilerplate,
as seen in the updated deno_core examples.
This change may also reduce serialization and deserialization overhead as serde
has a better idea of what types it is working with. I am currently working on
benchmarks to confirm this and I will update this PR with my findings.
Diffstat (limited to 'core/examples/http_bench_json_ops.js')
-rw-r--r-- | core/examples/http_bench_json_ops.js | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/core/examples/http_bench_json_ops.js b/core/examples/http_bench_json_ops.js index 80c5a6115..071df100f 100644 --- a/core/examples/http_bench_json_ops.js +++ b/core/examples/http_bench_json_ops.js @@ -11,7 +11,7 @@ const responseBuf = new Uint8Array( /** Listens on 0.0.0.0:4500, returns rid. */ function listen() { - const { rid } = Deno.core.jsonOpSync("listen", {}); + const { rid } = Deno.core.jsonOpSync("listen"); return rid; } |