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

deprecate write_tree_flag in favor of direct method arguments #163

Merged
merged 19 commits into from
Apr 22, 2022

Conversation

joeljonsson
Copy link
Collaborator

@joeljonsson joeljonsson commented Jan 10, 2022

Resolve some of the issues discussed in #160 and fixes current errors with examples (#162, but testing examples is still a good idea). Notable changes:

  • remove all uses of the write_tree_flag and mark the set/get methods as deprecated
  • write_apr now takes fourth argument:
    bool write_apr(APR& apr,uint64_t t = 0,std::string channel_name = "t", bool write_tree = true);
  • read_apr reads the APR and tries to read the tree. If the tree does not exist, it initializes it from the APR structure it is left uninitialized until required by other methods.
  • for particle i/o and lazydata, dataset existence is checked and handled based on the apr_or_tree argument

The new behavior of read_apr has some performance implications. Reading the tree is quite fast (adds ~5-15% to overall read time), but initializing the tree from the APR is significantly slower (makes overall read time up to 7 times longer). Perhaps the default behavior if the tree data is not on file should be to leave it uninitialized. What do you think @cheesema?

- now takes a parameter `require_tree` instead of `tree`
- prints and returns false if APR data group does not exist
- prints and returns false if `require_tree=true` but tree group does
not exist
- if tree data exists, it is opened regardless of `require_tree`
- refactor usages (this change should not break anything)
Deprecate use of write_tree_flag and related methods.
Note that a side effect of this is that in order to write an APR file without the tree data, one has to specify t and channel_name, due to the order of arguments
NOTE: this change affects read times since read_apr now initializes the
tree structure
@joeljonsson joeljonsson requested a review from cheesema January 12, 2022 15:59
@joeljonsson
Copy link
Collaborator Author

joeljonsson commented Apr 8, 2022

This resolves #164
read_apr no longer initializes the tree. Instead, that is done in methods which require it, or can be done manually.

@cheesema I think this is ready

@joeljonsson joeljonsson mentioned this pull request Apr 9, 2022
@joeljonsson joeljonsson mentioned this pull request Apr 20, 2022
@joeljonsson joeljonsson requested a review from krzysg April 21, 2022 12:00
@krzysg
Copy link
Member

krzysg commented Apr 21, 2022

I do not have more specific comments. I do not really like how APR.hpp looks but** it is not connected to this specific changes but in general it ... screams for big refactoring which is not (and should not be) part of this PR.

@joeljonsson
Copy link
Collaborator Author

Good points. I think large parts of the library need a major cleanup -- not just removing unused and deprecated code, but also restructuring and rethinking some classes.

I will merge this for now though

@joeljonsson joeljonsson merged commit 746885b into develop Apr 22, 2022
@joeljonsson joeljonsson deleted the rm_io_tree_flag branch April 22, 2022 11:19
@krzysg krzysg mentioned this pull request Apr 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Need a linear iterator based initialisatoin to the tree iterator
2 participants