-
Notifications
You must be signed in to change notification settings - Fork 1
Search and address TODO and FIXME #4
Comments
@ervanSTRI, I noticed some issues that may make your code run much faster. In three places, the code grows objects instead of pre-allocating an object with the required structure (number of columns, rows, list elements, etc.) and then modifying each element in place. See my comments and let me know if it's unclear. Generally, you can completely avoid this issue with lapply(). If you still need a for loop, then ensure to create an object with all the elements that will later be replaced (instead of created) inside the for loop. |
Ok. I now see your code and comments. First question: why does the online version differ from the one I have in my package? I've seen the first occurrence you are referring to, but wonder if it saving a lot of time in filling vs cbind-ing a data-frame. I'll give it a try. |
Lines 118, 675, and 845 in AGBfluxes_functions.R. The source of I would start by fixing the receiving data-structure, and checking if it really improves how fast the code runs. If you achieve better performance, then transforming the code to
To learn more about the transition from for loops to These things are often better shown than explained. But I can't help much until I'm able to run your code and produce an output I can test against. Without that, any change I do may brake something inadvertently. Issue #20 is the priority. |
I flagged a few things with TODO and FIXME that need to be addressed.
The text was updated successfully, but these errors were encountered: