From fb36d5c8a74f94b1bc919acdd088b44048e14a8d Mon Sep 17 00:00:00 2001 From: Robert Kruszewski Date: Wed, 26 Jun 2024 17:50:26 +0100 Subject: [PATCH] Don't validate array flatbuffer message twice --- vortex-ipc/src/message_reader.rs | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/vortex-ipc/src/message_reader.rs b/vortex-ipc/src/message_reader.rs index 27c1c2e05e..d4c36a9f7e 100644 --- a/vortex-ipc/src/message_reader.rs +++ b/vortex-ipc/src/message_reader.rs @@ -189,14 +189,11 @@ impl MessageReader { dtype, flatbuffer, |flatbuffer| { - root::(flatbuffer) - .map_err(VortexError::from) - .map(|msg| msg.header_as_chunk().unwrap()) - .and_then(|chunk| { - chunk - .array() - .ok_or_else(|| vortex_err!("Chunk missing Array")) - }) + unsafe { root_unchecked::(flatbuffer) } + .header_as_chunk() + .unwrap() + .array() + .ok_or_else(|| vortex_err!("Chunk missing Array")) }, buffers, )?;