-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added small piece of code to inspect heap allocations
- Loading branch information
Showing
1 changed file
with
26 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
use nbezier::nbezier::BezierCurve; | ||
use nalgebra::{Matrix2x4, Matrix2xX}; | ||
use criterion::black_box; | ||
|
||
#[global_allocator] | ||
static ALLOC: dhat::Alloc = dhat::Alloc; | ||
|
||
fn main() { | ||
let profiler = dhat::Profiler::new_heap(); | ||
let curve = BezierCurve(Matrix2x4::new( | ||
50.0, 200.0, 0.0, 50.0, 0.0, 33.0, 66.0, 100.0 | ||
)); | ||
black_box(curve.split(0.5)); | ||
black_box(curve.castlejau_eval(0.5)); | ||
black_box(curve); | ||
drop(profiler); | ||
|
||
let profiler = dhat::Profiler::new_heap(); | ||
let curve = BezierCurve(Matrix2xX::from_iterator(4, | ||
[50.0, 200.0, 0.0, 50.0, 0.0, 33.0, 66.0, 100.0] | ||
)); | ||
black_box(curve.split(0.5)); | ||
black_box(curve.castlejau_eval(0.5)); | ||
black_box(curve); | ||
drop(profiler); | ||
} |