adiar icon indicating copy to clipboard operation
adiar copied to clipboard

Simplify `levelized_file_writer.has_pushed()` implementation

Open SSoelvsten opened this issue 2 years ago • 1 comments

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 avatar Apr 20 '22 14:04 SSoelvsten

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.

SSoelvsten avatar Dec 10 '22 14:12 SSoelvsten