-
Notifications
You must be signed in to change notification settings - Fork 73
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
Batch the metadata and console messages #1055
Comments
I got this working for the metadata files in https://github.com/ropensci/targets/tree/1055, and those specific bottlenecks are removed (as long as the new |
what you are doing, restless, is just amazing. Thanks so much William. |
Thanks for the kind words. I just merged the current updates into |
Should be fixed now. Really glad these bottlenecks are removed! #1056 is all the more noticeable now, and I will tackle that next. |
When I originally implemented batched updating for metadata files, the saved metadata lagged behind the current in-memory metadata, and this caused #1063. At the time, I patched #1063 by disabling batched writes for new rows in As far as I know, literate programming integration is the only scenario where #1063 comes up (although I will need to trawl
(1) would be efficient, but I do not think it is feasible with |
Also need to worry about hacks like #830 (comment) which require |
Prework
Proposal
I often use this
_targets.R
file for benchmarking/profiling studies:I profile it with
proffer
:As of 4757d06, the flame graph on my local Macbook looks like this:
There is a clear bottleneck because of how
targets
writes metadata and progress data one line at a time to the text files in_targets/meta/
.base::write()
itself isn't the bottleneck because I tried a C implementation which is only slightly faster. I also tried supplying a persistent file connection instead of the file path, but that too was only slightly faster.I think I will try batching metadata lines into groups and then writing them only at regular intervals, e.g. a few times a second. A simpler version of this helped skipped messages print a lot faster.
The text was updated successfully, but these errors were encountered: