-
-
Notifications
You must be signed in to change notification settings - Fork 12
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
Overhaul options creation #88
base: main
Are you sure you want to change the base?
Conversation
commit: |
Also I have a question: Are found paths both processed in |
i haven't had the time to look at this pr, but answering your question: wouldn't work in most cases. fdir exclude paths are always absolute and filter paths aren't, plus the fact that you wouldn't even find directories in filter unless you set up the options to also receive dirs |
Yeah, I tried caching anywhere and the tests started to fail. Damn... |
I've realized the way tinyglobby manages it's own options was copy pasted between This also included some tiny restructurings and an additional type called This change reduced the bundle size by another ~350 bytes. ESM dist\index.mjs 9.23 KB
ESM dist\index.mjs.map 20.09 KB
ESM ⚡️ Build success in 18ms
CJS dist\index.js 11.19 KB
CJS dist\index.js.map 20.22 KB
CJS ⚡️ Build success in 19ms
DTS Build start
DTS ⚡️ Build success in 908ms
DTS dist\index.d.mts 1.01 KB
DTS dist\index.d.ts 1.01 KB |
I found some more options handling logic in Edit: After reverting the |
We are almost at 1KB reduced file size, basically almost 10% reduction. The only question is the behavior of So this question is: Do |
yes they do, because those options are meant to default to |
Okay, so the |
okay! i thought initializing them to |
Well, there should always be a balance of package size and performance. If you care too much about package size, it's going to be slow, if you care too much about performance, it's going to be unreadable (because everything theoretically makes the program slower). I know one or two big projects that accidentally introduced this third buggy state of Defining all necessary default options makes the code look bigger, but is the most clean and easy to maintain way. You can define your options type as strict as possible, are able to process it centrally and use the input value with Using this approach made this project almost 1KB smaller with this PR. Speaking of performance: Since objects are dynamically sized and shaped, JS engines introduced the concept of a "shape" to optimize and organize the heap by implicitly defining two objects with the same properties as one fixed "shape" like two instances of a class. This improves performance as the engine becomes aware of what kind of object you want to use. TypeScript helps you utilize this concept better by defining interfaces for your objects or force you to define all properties of a class outside of the constructor to make the shape of an object static. So changing the values of properties is extremely fast, but adding and removing properties with |
@SuperchupuDev Okay, I'm done and everything should be ready. If there is anything wrong with it, Let me know. I'd be happy if this could be merged 🙏 Edit: Also I optimized a tiny thing from #91. Instead of splitting every time, we can just check |
great! will check it out at some point. no ETA since i got a cold and there's no rush for a new release right now anyways |
Oh no!! Get well soon and don't stress yourself! ♥ |
Hi, me again.
After updating the performance of this project, I decided to reduce the package size even further and clean it further up by overhauling how fdir options are built with the given options and properties.
What did I do?
getPartialMatcher
This reduced the build size from
to
which is around 400b.
It seems like biome doesn't support 32 bit windows (or there is any other bug), so I can't lint and format :(