Skip to content

Commit fc41560

Browse files
perf(kernel::rendy): do not over-allocate
Regresssion. In future, the `alloc_boxed_buffer` must be fully removed. The zeroing is also not required. Signed-off-by: Anhad Singh <[email protected]>
1 parent d6c5a66 commit fc41560

File tree

3 files changed

+6
-12
lines changed

3 files changed

+6
-12
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,3 +34,4 @@ host-pkgs/
3434
host-builds/
3535
pkgs/
3636
builds/
37+
raw-data

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ qemu: $(KERNEL_TARGET) $(USERLAND_TARGET)
4848

4949
.PHONY: qemu_perf
5050
qemu_perf: $(KERNEL_TARGET) $(USERLAND_TARGET)
51-
${QEMU_PATH}/qemu-system-x86_64 -cdrom target/aero.iso -m 8G -serial stdio --boot d -s -drive file=target/disk.img,if=none,id=NVME1,format=raw -device nvme,drive=NVME1,serial=nvme -plugin './target/kern-profile.so,out=raw-data,delay=30' -d plugin -cpu max
51+
${QEMU_PATH}/qemu-system-x86_64 -cdrom target/aero.iso -m 8G -serial stdio --boot d -s -drive file=target/disk.img,if=none,id=NVME1,format=raw -device nvme,drive=NVME1,serial=nvme -plugin './target/kern-profile.so,out=raw-data,delay=25' -d plugin -cpu max
5252

5353
.PHONY: qemu_p
5454
qemu_p:

src/aero_kernel/src/rendy.rs

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -738,17 +738,10 @@ impl<'this> DebugRendy<'this> {
738738
let cols = (width - DEFAULT_MARGIN * 2) / FONT_WIDTH;
739739
let rows = (height - DEFAULT_MARGIN * 2) / FONT_HEIGHT;
740740

741-
let grid_size = rows * cols * core::mem::size_of::<Character>();
742-
let grid = mem::alloc_boxed_buffer::<Character>(grid_size);
743-
744-
let queue_size = rows * cols * core::mem::size_of::<QueueCharacter>();
745-
let queue = mem::alloc_boxed_buffer::<QueueCharacter>(queue_size);
746-
747-
let map_size = rows * cols * core::mem::size_of::<Option<*const QueueCharacter>>();
748-
let map = mem::alloc_boxed_buffer::<Option<*mut QueueCharacter>>(map_size);
749-
750-
let bg_canvas_size = width * height * core::mem::size_of::<u32>();
751-
let bg_canvas = mem::alloc_boxed_buffer::<u32>(bg_canvas_size);
741+
let grid = mem::alloc_boxed_buffer::<Character>(rows * cols);
742+
let queue = mem::alloc_boxed_buffer::<QueueCharacter>(rows * cols);
743+
let map = mem::alloc_boxed_buffer::<Option<*mut QueueCharacter>>(rows * cols);
744+
let bg_canvas = mem::alloc_boxed_buffer::<u32>(width * height);
752745

753746
let mut this = Self {
754747
inner: Inner {

0 commit comments

Comments
 (0)