Skip to content
Snippets Groups Projects
Commit 83868d29 authored by Per Lindgren's avatar Per Lindgren
Browse files

pool benchmark

parent a2ed7beb
No related branches found
No related tags found
No related merge requests found
# Benchmark
Here we focus on the allocation and deallocation.
``` Rust
mod app {
pub const U: usize = 2;
pub static P: PoolMan<u32, U> = PoolMan::new([0; U]);
...
}
use poolman::{Poolman, Box, Error};
#[inline(never)]
fn just_alloc() -> Result<Box<u32, { app::U }>, Error> {
app::P.alloc()
}
```
``` arm
08000256 <poolman::just_alloc>:
8000256: b580 push {r7, lr}
8000258: 466f mov r7, sp
800025a: f240 0200 movw r2, #0
800025e: f2c2 0200 movt r2, #8192 ; 0x2000
8000262: f892 1028 ldrb.w r1, [r2, #40] ; 0x28
8000266: b171 cbz r1, 8000286 <poolman::just_alloc+0x30>
8000268: f3ef 8c10 mrs ip, PRIMASK
800026c: b672 cpsid i
800026e: 6a53 ldr r3, [r2, #36] ; 0x24
8000270: f00c 0c01 and.w ip, ip, #1
8000274: eb02 0183 add.w r1, r2, r3, lsl #2
8000278: 69c9 ldr r1, [r1, #28]
800027a: 6251 str r1, [r2, #36] ; 0x24
800027c: 2903 cmp r1, #3
800027e: d305 bcc.n 800028c <poolman::just_alloc+0x36>
8000280: 2201 movs r2, #1
8000282: 7042 strb r2, [r0, #1]
8000284: e007 b.n 8000296 <poolman::just_alloc+0x40>
8000286: 2101 movs r1, #1
8000288: 8001 strh r1, [r0, #0]
800028a: bd80 pop {r7, pc}
800028c: f102 0114 add.w r1, r2, #20
8000290: 2200 movs r2, #0
8000292: e9c0 3101 strd r3, r1, [r0, #4]
8000296: f1bc 0f00 cmp.w ip, #0
800029a: 7002 strb r2, [r0, #0]
800029c: bf18 it ne
800029e: bd80 popne {r7, pc}
80002a0: b662 cpsie i
80002a2: bd80 pop {r7, pc}
```
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment