From 8fe9b8a4cc381f9b94ce2caf10c61ddff864bdb4 Mon Sep 17 00:00:00 2001 From: Matt Mastracci Date: Sun, 25 Jun 2023 16:36:09 +0200 Subject: refactor(ops): ops2 supports result in fast path (#19603) Implements `Result` in fast-calls. Note that the approach here is slightly different. Rather than store the last result in the `OpState`, we put it into the `OpCtx` which saves us a lookup and lock in the error case. We do not have to lock this field as it's guaranteed only one runtime and thread can ever access it. The fastcall path for many ops can avoid doing a great deal of work, even for `Result` return values. In the previous iteration of `ops`, all `Result`-returning functions would fetch and lock the `OpState`, regardless of whether it was used or not. --- ops/op2/test_cases/sync/result_void.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'ops/op2/test_cases/sync/result_void.rs') diff --git a/ops/op2/test_cases/sync/result_void.rs b/ops/op2/test_cases/sync/result_void.rs index 41256e8c4..ef3aa7b32 100644 --- a/ops/op2/test_cases/sync/result_void.rs +++ b/ops/op2/test_cases/sync/result_void.rs @@ -1,4 +1,4 @@ // Copyright 2018-2023 the Deno authors. All rights reserved. MIT license. -#[op2] +#[op2(fast)] pub fn op_void_with_result() -> Result<(), AnyError> {} -- cgit v1.2.3