SSoelvsten / adiar

An I/O-efficient implementation of (Binary) Decision Diagrams
https://ssoelvsten.github.io/adiar/
MIT License
24 stars 13 forks source link

Simplify `levelized_file_writer.has_pushed()` implementation #316

Open SSoelvsten opened 2 years ago

SSoelvsten commented 2 years ago

The implementation of meta_writer::has_pushed() can be replaced with size() > 0 || levels() > 0. This would remove almost identical code, but would also be slower than the current piece of code, since it does not return early.

_Originally posted by @AnnaBlume99 in https://github.com/SSoelvsten/adiar/pull/315#discussion_r854093962_

SSoelvsten commented 1 year ago

Right now, has_pushed is only ever used once per algorithm. That is, any small performance decrease is not really noteworthy. So, the improvement in code quality in comparison to the (almost non-existing) performance decrease is (arguably) worth it.