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

Updates for a faster link command. #119

Merged
merged 3 commits into from
Oct 14, 2014
Merged

Conversation

dougborg
Copy link
Contributor

  • Don't store intermediate paths variable; use pipes.
  • Use process substitution to speed up loops.
  • Minor clean-up & fix a few shellcheck warnings.
  • Linking files with a newline is not actually fixed, but the
    behavior did change slightly, so I updated the test.

@andsens
Copy link
Owner

andsens commented Oct 13, 2014

Dayum, this looks really nice :-)
I'm a bit exhausted from work, so my brain is not functioning perfectly right now. I'll have a proper look at it tomorrow and merge it.

paths="$relpath$path\n$paths"
done
done
pending "list files" "$repo_dir" >&2
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It may be good to consider logging everything in homeshick to stderr instead of most things to stdout, and only errors to stderr (from what I remember of my brief look at log.sh, I think that is the current behavior). Logging to stderr in bash scripts enables you to log things without polluting stdout, which often gets piped around or evaluated by other functions. I would be happy to do the work if you feel like it is a good idea as well.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, and this line along with the success line at the end of the function lets the user know an operation is happening so impatient fools (like myself) are less likely to CTRL-C after a few seconds because it looks like nothing is happening 😄.

BTW, I really like the way you have done your logging with the pending / success functions - it looks really slick.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think anything other than progress should be logged to stdout, it should be machine-readable however (I created #70 a long time ago to track progress on that, still haven't gotten around to it :-)).

BTW, I really like the way you have done your logging with the pending / success functions - it looks really slick.

Thanks! It was fun to code as well, hehe.

@andsens
Copy link
Owner

andsens commented Oct 14, 2014

Holy balls! The speedup is insane! I didn't even have the patience to wait for the current version to list all of the >3000 files. The new version takes about 30s, I'm impressed :-)

 - Don't store intermediate `paths` variable; use pipes.
 - Use process substitution to speed up loops.
 - IFS manipulation did not appear to be doing anything helpful, so I
   removed it.
 - Linking files with a newline is not actually fixed, but the
   behavior did change slightly, so I updated the test.
@dougborg
Copy link
Contributor Author

Hopefully this set of commits looks better. Sorry about the force push - I figured that was the best way to do it, but you will have to git reset --hard on your local.

@andsens
Copy link
Owner

andsens commented Oct 14, 2014

Sorry about the force push

Don't be

I figured that was the best way to do it

It is :-)

but you will have to git reset --hard on your local.

No need, a simple diff shows me that nothing's changed since I last tested it.

Merging...

p.s.: This is a great improvement to the link command. Please feel free to submit as many PRs as you like, your code is top-notch quality 👍

andsens added a commit that referenced this pull request Oct 14, 2014
Updates for a faster link command.
@andsens andsens merged commit 50f9d8c into andsens:development Oct 14, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants