This repository was archived by the owner on Aug 16, 2021. It is now read-only.
This repository was archived by the owner on Aug 16, 2021. It is now read-only.
Memory bloat #44
Open
Description
The code (basing on the example from the readme)
#![recursion_limit = "1024"]
#[macro_use]
extern crate error_chain;
mod errors {
error_chain! { }
}
fn main () {
use errors::Result as ChainResult;
use std::mem::size_of;
println!("size of vanilla result {}", size_of::<Result<(), ()>>());
println!("size of error_chain result {}", size_of::<ChainResult<()>>());
}
outputs:
size of vanilla result 1
size of error_chain result 56
I might be wrong, but isn't ChainResult
just "yet another enum", which means those 55 extra bytes have to be copied over when returning, even in the success event? That would mean quite a performance overhead over normal Result in hot code, especially where only the Ok case which may be minimal is encountered, no?
Maybe the situation can be improved by making the backtrace functionality optional, as in possible to opt out of at compile time?
Metadata
Metadata
Assignees
Labels
No labels