Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ceify metro #471

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open

Ceify metro #471

wants to merge 7 commits into from

Conversation

trentgill
Copy link
Collaborator

@trentgill trentgill commented Feb 21, 2023

Continuing the ceify journey.

Fixes #470

this replaces the lua implementation of the metro lib with a C based one. there's still a little lua stub file which does the linking because i just wanted to get it in and tested. could save a little more RAM by doing the assignments in C, but this feels like a good place to leave it and move on to bigger fish.

increases the FLASH usage by 60bytes
decreases runtime RAM usage by 2.85kB (current runtime is 90.6kB at launch)

not a lot of a benefit really (especially bc it took me 6+ hours though most of that was airplane brain), but it is a solid 6% relative to the logical minimum (about 45kB).

//

i'm realizing the big benefit to come from these routines is not so much about shrinking the amount of lua code that is loaded into the runtime, but rather about reducing the amount of dynamic allocation happening as a result of using the libraries.

going forward, i'm going to focus on libraries that allocate lots of data when you use them (sequins, clock, asl). i think clock is the biggest culprit as creating and pause/resuming a bunch of coroutines is i think quite heavy on the runtime.

come to think of it, i should do some analysis of what is causing the ram usage. forthcoming...

//

but for now, this feels like a solid inclusion & all of the documented usage in the reference is working correctly in my testing.

// EDIT
after a little further testing, it seems that the clock library is just fine churning through garbage. the collection routinely brings usage back down to ~95kB as a number of simultaneous clocks are banging away.

going to move on to re-introducing the timeline library and see if i can recreate the issues i was experiencing which sent me down this path many moons ago...

@trentgill trentgill requested a review from tehn February 21, 2023 06:04
@trentgill trentgill mentioned this pull request Feb 21, 2023
Copy link
Member

@tehn tehn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

code looks good, haven't tested in hardware.

this is a great endeavor--- weirdly inspiring? i'd be curious to see some metrics about the impact on execution time (not asking you to do this!)

fantastic work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ceify the metro lib
2 participants