WerWolv / libtesla

The support library for Tesla overlays
GNU General Public License v2.0
218 stars 49 forks source link

Font cache #57

Closed HookedBehemoth closed 2 years ago

HookedBehemoth commented 2 years ago

Don't know how long that first commit was pending. I just rebased and only saw it here now.

Edit: Just noticed an issue with that commit and I don't feel like debugging something I wrote a year ago. Gonna remove that commit.

WerWolv commented 2 years ago

Hey I was worried about memory usage which is why I never did this. Have you checked how much extra memory is being used with this?

HookedBehemoth commented 2 years ago

Pondering over how to actually meassure this. Found this file in dkA64 newlib: https://github.com/devkitPro/newlib/blob/devkitA64/libgloss/libsysbase/sbrk.c Suggests to me that this should work:

u64 ram_total = (u64)fake_heap_end - (u64)fake_heap_start;
void *tmp = malloc(1);
u64 ram_usage = (u64)tmp - (u64)fake_heap_start;
free(tmp);

The results are irritating though. available: 5869568 pre patch: 96464 post patch: it jumps between 109488 and 1755648.

HookedBehemoth commented 2 years ago

Render time in Tesla-Menu goes down from ~9ms to ~5ms

HookedBehemoth commented 2 years ago

god fuck newlib

HookedBehemoth commented 2 years ago

Oh well I resorted back to just meassure the allocation size of stbtt_GetCodepointBitmap which is 16355 bytes. Missing is the bucket size and the additional code size of the container.

WerWolv commented 2 years ago

Thank you! Yeah I think that should be alright. The rendering time decrease really does sound great