Git Commands Slowness

We are working in git repo for last 2 years with a repo having 3000+ branches. We are using many git commands in our tools one of which is git branch command. The below given branch command takes more than 2 minutes to process a single request. Is there any way to optimise this slowness or any other command to get the same output.

Example Command : git branch -a --contains #commit-id

You can run git fsck to check the object integrity.

Cleaning up branches which have been deleted on the remote server needs a longer command. I keep a shell alias for that, which deletes all merged branches. -D would delete all branches, merged, and unmerged, where the remote branch is gone. Note that git fetch —prune is not enough.

# Delete all remote tracking Git branches where the upstream branch has been deleted
alias git_prune="git fetch --prune && git branch -vv | grep 'origin/.*: gone]' | awk '{print \$1}' | xargs git branch -d"