-
-
Notifications
You must be signed in to change notification settings - Fork 15
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
update-bcd: rewrite update function logic #801
update-bcd: rewrite update function logic #801
Conversation
Generated by release.js.
* update-bcd: fix getSupportMatrix overrides param type * fixup! update-bcd: fix getSupportMatrix overrides param type --------- Co-authored-by: Queen Vinyl Da.i'gyu-Kazotetsu <vinyldarkscratch@gmail.com>
This was causing issues with passing arguments into the scripts.
Generated by release.js.
@mzgoddard there are conflicts here, can you resolve? |
Areas for ImprovementHere are some areas that I think could be better in this PR.
Possible Follow-up Work
|
f8aec8c
to
2b3d194
Compare
I think this PR is ready for review. I fixed bugs and differences I had incidentally added. I've tried to keep the branching logic in the existing version of the script to make it easier to compare. I think this might also make it more readable by collecting the logic. Many I stroke through the fourth todo. I think we can add it as a follow up. As part of this I've implemented the reason function improvement I mentioned earlier. Kind of like the throw reason one all of the reasons are returned and are produced by an earlier version's
For the As an aside I made a try at the first further work section, iterating |
I've cleaned up some tests for the I can make a separate PR or push them here if that's better. Don't want to interfere with anyone already reviewing it with a big change like that. (Most of the change is in the test file. There is a small change to |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If I run update-bcd
with this PR, it creates the same updates to BCD as it does on main
. So that's good. Tests pass as well and it's great to see additional tests for the new helpers. Happy to have them in a follow-up.
I noticed the update-bcd
in this PR is slower than the one on main
. Is that due to the extra logging/helpers that are introduced here or is some iteration changed somewhere that slows it down?
I'm not the original author of update-bcd
and I find reviewing this PR quite challenging personally. That said, I'm happy to merge this in given it will help us to use the logs this produces programmatically for our project.
How can I use the log object? Maybe that's done in bocoup@9a202ed? Would it be good to provide a new log output format (json) that I can get from the command line? npm run update-bcd --log=json
or is there another way you use the Log?
Sorry, if I'm asking obvious things here. I will try to read into the code some more but update-bcd
really is quite complex to me.
Also cc'ing @queengooborg and @teoli2003 who I hope could help with the review here. |
I'd be happy to review this, but wasn't sure if I should jump in because I won't be a primary maintainer for the collector now that it's moved into OWD. Please let me know if my review would help / be enough to land this. Regarding the logging, the plan is to do logging to a file or similar as a follow-up to this. |
Thanks @foolip! I think your review would definitely help! From the OWD side, I consider @queengooborg the main maintainer of this project but I think we are all acting as Peers here, so stuff can land once a Peer approves a PR. Adding a governance doc to this repo is still on my to-do list. Sorry for being slow with that. |
👍
Yes. It's much slower. I profiled it at one point to see if there were simple changes I might make to speed it up. Its spending a lot of time doing a few things. It spends most of its time in the generators produced by Outside of I've opted to not do that change at this point in a desire to make this easier to review by having comparable order of logic with the current version.
Yeah. The change of indent on the if/else blocks makes it hard to review.
As @foolip already replied we'll set this up in a follow up. I think that'll be good so we can shake out details like how they are logged in their own PR.
No, I think they're good questions. |
@mzgoddard can you add a bit of documentation explaining the basic data flow? In particular I'd like to understand the roles of It sounds like the performance problem has something to do with the number of temporary objects being generated, and perhaps it will be clear where the unnecessary work is happening given a description of the data flow. |
@foolip You're correct that a state object is passed around and updated throughout the composed generator functions. This state object is of the The I do think it will be helpful for all of us to have a more detailed, step-by-step summary/visualization of the exact transformations that happen to
Yes, I can work on a more detailed diagram of the data flow, and add a few more test assertions to better document what's happening (especially in the |
@foolip @Elchi3 confirmed that this recent iterator change reduces the overall execution time of the update script by about ~2x. From my last local run, execution time on the |
Thank you @ChrisC! I have also tested the script before and after these changes. It seems faster, although I didn't measure by how much. Very nice! I've also confirmed that I have reviewed the code, and while I think it would benefit from some more high-level documentation, I also think this PR can be merged so that additional changes can be more incremental. |
Summary
Rewrite update-bcd's update function into a series of smaller composable functions and generators.
Differences from mdn/browser-compat-data#20209
Update
types in typescript interfaces.expand
andcompose
.TODO
provide_entry
: currently can't match paths to Identifiers inbcd
files. (Every iteration is filtered atfilter_entryExists
at the moment.)eslint(no-unused-vars)
. (Seems to be a bug in eslint. The vars its complaining about are used.)Log updates to a log file.update
is called multiple times, maybe pass a function toupdate
's options to emit logs? Inmain
the function would concat an array and serialize it to a log file at the end? Or it could append each change alone to a log file?Related Issues
mdn/browser-compat-data#19868
mdn/browser-compat-data#20209