reduce memory overhead

by storing indices (u8) in the queues instead of pointers (*mut u8)

in the binary heap we store the baseline inline along with the index and the task name. Before we
stored a pointer to the message and had to lookup the baseline when comparing two nodes in the heap.
This commit is contained in:
Jorge Aparicio 2018-05-04 10:59:23 +02:00
parent 6de27b9a64
commit 0cc456ba80
10 changed files with 227 additions and 233 deletions

View file

@ -1,3 +1,11 @@
// # Pointers (old)
//
// ~40~ 32 bytes .bss
//
// # Indices (new)
//
// 12 bytes .bss
#![deny(unsafe_code)]
#![deny(warnings)]
#![feature(proc_macro)]

View file

@ -1,16 +1,36 @@
// 52 bytes .bss
// # Pointers (old)
//
// ~52~ 48 bytes .bss
//
// # -Os
//
// init
// a(bl=8000000, now=8000180, input=0)
// a(bl=16000000, now=16000180, input=1)
// a(bl=24000000, now=24000180, input=2)
//
// # -O3
//
// init
// a(bl=8000000, now=8000168, input=0)
// a(bl=16000000, now=16000168, input=1)
// a(bl=24000000, now=24000168, input=2)
//
// # Indices (new)
//
// 32 bytes .bss
//
// ## -O3
//
// init
// a(bl=8000000, now=8000170, input=0)
// a(bl=16000000, now=16000170, input=1)
//
// ## -Os
//
// init
// a(bl=8000000, now=8000179, input=0)
// a(bl=16000000, now=16000179, input=1)
#![deny(unsafe_code)]
#![deny(warnings)]

View file

@ -1,6 +1,9 @@
// 104 bytes .bss
// # Pointers (old)
//
// ~104~ 88 bytes .bss
//
// ## -Os
//
// # -Os
// a(bl=16000000, now=16000248, input=0)
// b(bl=24000000, now=24000251, input=0)
// a(bl=32000000, now=32000248, input=1)
@ -11,8 +14,9 @@
// a(bl=80000000, now=80000248, input=4)
// b(bl=96000000, now=96000283, input=3)
// a(bl=96000000, now=96002427, input=5)
// # -O3
//
// ## -O3
//
// init
// a(bl=16000000, now=16000231, input=0)
// b(bl=24000000, now=24000230, input=0)
@ -24,6 +28,37 @@
// a(bl=80000000, now=80000231, input=4)
// b(bl=96000000, now=96000259, input=3)
// a(bl=96000000, now=96002397, input=5)
//
// # Indices (new)
//
// 56 bytes .bss
//
// ## -O3
//
// a(bl=16000000, now=16000215, input=0)
// b(bl=24000000, now=24000214, input=0)
// a(bl=32000000, now=32000215, input=1)
// b(bl=48000000, now=48000236, input=1)
// a(bl=48000000, now=48002281, input=2)
// a(bl=64000000, now=64000215, input=3)
// b(bl=72000000, now=72000214, input=2)
// a(bl=80000000, now=80000215, input=4)
// b(bl=96000000, now=96000236, input=3)
// a(bl=96000000, now=96002281, input=5)
//
// ## -Os
//
// init
// a(bl=16000000, now=16000257, input=0)
// b(bl=24000000, now=24000252, input=0)
// a(bl=32000000, now=32000257, input=1)
// b(bl=48000000, now=48000284, input=1)
// a(bl=48000000, now=48002326, input=2)
// a(bl=64000000, now=64000257, input=3)
// b(bl=72000000, now=72000252, input=2)
// a(bl=80000000, now=80000257, input=4)
// b(bl=96000000, now=96000284, input=3)
// a(bl=96000000, now=96002326, input=5)
#![deny(unsafe_code)]
#![deny(warnings)]

View file

@ -1,6 +1,9 @@
// 96 bytes .bss
// # Pointers (old)
//
// ~96~ 80 bytes .bss
//
// # -Os
//
// init
// a(bl=16000000, now=16000249)
// b(bl=24000000, now=24000248)
@ -12,8 +15,9 @@
// a(bl=80000000, now=80000249)
// b(bl=96000000, now=96000282)
// a(bl=96000000, now=96001731)
//
// # -O3
//
// init
// a(bl=16000000, now=16000228)
// b(bl=24000000, now=24000231)
@ -25,6 +29,38 @@
// a(bl=80000000, now=80000228)
// b(bl=96000000, now=96000257)
// a(bl=96000000, now=96001705)
//
// # Indices (new)
//
// 48 bytes .bss
//
// ## -O3
//
// init
// a(bl=16000000, now=16000213)
// b(bl=24000000, now=24000212)
// a(bl=32000000, now=32000213)
// b(bl=48000000, now=48000234)
// a(bl=48000000, now=48001650)
// a(bl=64000000, now=64000213)
// b(bl=72000000, now=72000212)
// a(bl=80000000, now=80000213)
// b(bl=96000000, now=96000234)
// a(bl=96000000, now=96001650)
//
// ## -Os
//
// init
// a(bl=16000000, now=16000253)
// b(bl=24000000, now=24000251)
// a(bl=32000000, now=32000253)
// b(bl=48000000, now=48000283)
// a(bl=48000000, now=48001681)
// a(bl=64000000, now=64000253)
// b(bl=72000000, now=72000251)
// a(bl=80000000, now=80000253)
// b(bl=96000000, now=96000283)
// a(bl=96000000, now=96001681)
#![deny(unsafe_code)]
#![deny(warnings)]

View file

@ -1,13 +1,33 @@
// 52 bytes .bss
// # Pointers (old)
//
// ~52~ 40 bytes .bss
//
// ## -Os
//
// # -Os
// init
// a(bl=8000000, now=8000180)
// a(bl=16000000, now=16000180)
//
// # -O3
// ## -O3
//
// a(bl=8000000, now=8000168)
// a(bl=16000000, now=16000168)
//
// # Indices (new)
//
// 28 bytes .bss
//
// ## -Os
//
// init
// a(bl=8000000, now=8000176)
// a(bl=16000000, now=16000176)
//
// ## -O3
//
// init
// a(bl=8000000, now=8000167)
// a(bl=16000000, now=16000167)
#![deny(unsafe_code)]
#![deny(warnings)]