mirror of
https://github.com/denoland/deno.git
synced 2025-09-26 12:19:12 +00:00
Revert "Refactor dispatch handling (#2452)"
Due to performance regression:dc60fe9f30 (commitcomment-33943711)
This reverts commitdc60fe9f30
.
This commit is contained in:
parent
3dff147d0c
commit
1361e30223
18 changed files with 711 additions and 669 deletions
|
@ -151,27 +151,14 @@ SharedQueue Binary Layout
|
|||
|
||||
function handleAsyncMsgFromRust(buf) {
|
||||
if (buf) {
|
||||
handleAsyncMsgFromRustInner(buf);
|
||||
asyncHandler(buf);
|
||||
} else {
|
||||
while ((buf = shift()) != null) {
|
||||
handleAsyncMsgFromRustInner(buf);
|
||||
asyncHandler(buf);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function handleAsyncMsgFromRustInner(buf) {
|
||||
// DataView to extract cmdId value.
|
||||
const dataView = new DataView(buf.buffer, buf.byteOffset, 4);
|
||||
const promiseId = dataView.getInt32(0);
|
||||
// Uint8 buffer view shifted right and shortened 4 bytes to remove cmdId from view window.
|
||||
const bufViewFinal = new Uint8Array(
|
||||
buf.buffer,
|
||||
buf.byteOffset + 4,
|
||||
buf.byteLength - 4
|
||||
);
|
||||
asyncHandler(promiseId, bufViewFinal);
|
||||
}
|
||||
|
||||
function dispatch(control, zeroCopy = null) {
|
||||
maybeInit();
|
||||
// First try to push control to shared.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue