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

'Linting' for potential inefficiencies #2462

Open
gfwilliams opened this issue Feb 2, 2024 · 0 comments
Open

'Linting' for potential inefficiencies #2462

gfwilliams opened this issue Feb 2, 2024 · 0 comments

Comments

@gfwilliams
Copy link
Member

In Espruino we have quite a few functions that do multiple things...

eg:

jsvObjectSetChild(obj, "name", child);
jsvUnLock(child);

turns into:

jsvObjectSetChildAndUnLock(obj, "name", child);

Which for something that's used a lot can end up saving an awful lot of flash.

Ideally we should be able to have a list of these, and then run over the code and detect when code exists that uses the first pattern when it should use the second.

We have ... make lst; scripts/find_common_code.js bin/projectname.lst at the moment which looks at the final built code and has helped to detect glaring issues, but this doesn't stop new uses of the old pattern coming in which over time can add up to waste a lot of space.

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

No branches or pull requests

1 participant