Skip to content

Instantly share code, notes, and snippets.

View aleksuss's full-sized avatar
🦀
Working from home

Oleksandr Anyshchenko aleksuss

🦀
Working from home
View GitHub Profile
@aleksuss
aleksuss / bench_hanle_panics.rs
Created November 20, 2019 15:08
Bench handle panics
use criterion::{black_box, criterion_group, criterion_main, Criterion};
use std::panic;
fn simple_function(x: i64, y: i64) -> i64 {
x / y
}
fn simple_function_with_catch(x: i64, y: i64) -> Option<i64> {
let result = panic::catch_unwind(|| x / y);