Skip to content

Commit 2d20c06

Browse files
committed
Switch to bitcode.
Bitcode has a better performance characteristics at the moment. Signed-off-by: Narfinger <[email protected]>
1 parent d606cd9 commit 2d20c06

File tree

3 files changed

+6
-7
lines changed

3 files changed

+6
-7
lines changed

Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "ipc-channel"
3-
version = "0.20.1"
3+
version = "0.21.0"
44
description = "A multiprocess drop-in replacement for Rust channels"
55
authors = ["The Servo Project Developers"]
66
license = "MIT OR Apache-2.0"
@@ -31,7 +31,7 @@ win32-trace = []
3131
enable-slow-tests = []
3232

3333
[dependencies]
34-
bincode = "1"
34+
bitcode = { version = "0.6.6", features = ["serde"] }
3535
crossbeam-channel = "0.5"
3636
fnv = "1.0.3"
3737
futures-channel = { version = "0.3.31", optional = true }

src/error.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use thiserror::Error;
55

66
#[derive(Debug, Error)]
77
/// An error that occurs for serialization or deserialization
8-
pub struct SerializationError(#[from] pub(crate) bincode::Error);
8+
pub struct SerializationError(#[from] pub(crate) bitcode::Error);
99

1010
impl Display for SerializationError {
1111
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {

src/ipc.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ use crate::platform::{
1414
};
1515
use crate::{IpcError, TryRecvError};
1616

17-
use bincode;
17+
use bitcode;
1818
use serde::{de::Error, Deserialize, Deserializer, Serialize, Serializer};
1919
use std::cell::RefCell;
2020
use std::cmp::min;
@@ -330,8 +330,7 @@ where
330330
let os_ipc_shared_memory_regions;
331331
let os_ipc_channels;
332332
{
333-
bincode::serialize_into(&mut bytes, &data)
334-
.map_err(|e| SerializationError(e))?;
333+
bytes = bitcode::serialize(&data).map_err(|e| SerializationError(e))?;
335334
os_ipc_channels = mem::replace(
336335
&mut *os_ipc_channels_for_serialization.borrow_mut(),
337336
old_os_ipc_channels,
@@ -698,7 +697,7 @@ impl IpcMessage {
698697
.map(Some)
699698
.collect(),
700699
);
701-
let result = bincode::deserialize(&self.data[..]).map_err(|e| e.into());
700+
let result = bitcode::deserialize(&self.data[..]).map_err(|e| e.into());
702701
*os_ipc_shared_memory_regions_for_deserialization.borrow_mut() =
703702
old_ipc_shared_memory_regions_for_deserialization;
704703
mem::swap(

0 commit comments

Comments
 (0)