Skip to content
This repository has been archived by the owner on Feb 22, 2023. It is now read-only.

Poor code quality #3

Open
dragetd opened this issue Jun 14, 2017 · 3 comments
Open

Poor code quality #3

dragetd opened this issue Jun 14, 2017 · 3 comments

Comments

@dragetd
Copy link
Owner

dragetd commented Jun 14, 2017

The python code was written when I was starting to learn python. It has very poor quality. I should rewrite these simple scripts!

@n-st
Copy link

n-st commented Sep 27, 2017

"A friend is someone who has seen your code and still loves you." 😉

@n-st
Copy link

n-st commented Sep 27, 2017

Alright, I had a go at modularising the code to make it easier to re-use:

  • The chunker and compression benchmarks are now merged into a single script and run sequentially. (Reduces code duplication, but we might want a commandline switch to select which tests to run…)
  • Chunker tests always run with compression=none (dedup is done on uncompressed blocks, so the compression algorithm doesn't influence the work of the chunker).
  • Use Python's integrated tempdir creation and cleanup. This will avoid collisions between multiple parallel instances and ensure that the script respects $TMPDIR and cleans up the temporary directory even if something crashes.
  • The input data set can (and must) be given as a commandline argument (no more hardcoded paths).
  • The script prints usage instructions if the argument is invalid, -h or --help.
  • Error messages from Borg are passed on to the user.
  • The CSV output now has a header line, so the user doesn't have to inspect the code to understand what the various numbers mean.

Let me know if I've missed anything. :)

Complete overkill for a benchmark script, of course, but I needed a sense of achievement to unwind from upgrading legacy computer systems at work today. 😅

@dragetd
Copy link
Owner Author

dragetd commented Oct 4, 2017

Uh, I love it!

I almost forgot about this repository. xD Yes, your code looks a lot nicer. Especially with the borg 1.1 or 1.2 release, I'd like to re-run the benchmark. There had been various updates to the hashing and IO code.

And maybe write down some conclusions that can be backed up by numbers. Like 'Do not go too crazy with chunking as RAM will explode' or 'LZMA,* is only worth it on extremely slow network links.

Anyhow… please feel free to replace the link on the borg community repository. Once I get around to play with it, I'll send a PR with updated benchmark data. :)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants