nvbn / thefuck

Magnificent app which corrects your previous console command.
MIT License
85.7k stars 3.43k forks source link

Up to 1s lag when invoking "fuck" #371

Open MightyPork opened 9 years ago

MightyPork commented 9 years ago

It worked really good before, but now when I mistype git command and use fuck, I get lag:

$ git brnahc
git: 'brnahc' is not a git command. See 'git --help'.

Did you mean this?
        branch
$ fuck
--- 1 second lag ---
git branch [enter/↑/↓/ctrl+c]
--- press enter ---
* dev
  master
  .....

I have version 3.0.

The alias is installed as follows:

$ alias fuck
alias fuck='eval $(thefuck $(fc -ln -1))'

Ideas what to try?

Here's also my $PATH if it matters

/home/ondra/.gem/ruby/2.2.0/bin:/home/ondra/GNUstep/Tools:
/usr/local/sbin:/usr/local/bin:/usr/bin:/opt/android-sdk/platform-tools:
/usr/lib/jvm/default/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:
/usr/bin/core_perl:/home/ondra/bin:/home/ondra/.composer/vendor/bin

I'm on Arch Linux (64bit) with python 3.4.3

nvbn commented 9 years ago

Can you remove ~/.thefuck/.thefuck-cache and measure time again?

MightyPork commented 9 years ago

Small improvement, I tried "time fuck" and pressed ^C just when it appeared, and got 0.6s. So I think something like 0.5s. Maybe that's normal, not sure - I have SSD though, should be really fast...

nvbn commented 9 years ago

And can you post output of:

export THEFUCK_DEBUG=true
git br
fuck

?

MightyPork commented 9 years ago

Here it is:

$ git br
git: 'br' is not a git command. See 'git --help'.

Did you mean one of these?
    branch
    var
$ fuck
DEBUG: Run with settings: {'debug': True,
 'env': {'GIT_TRACE': '1', 'LANG': 'C', 'LC_ALL': 'C'},
 'no_colors': False,
 'priority': {},
 'require_confirmation': False,
 'rules': [],
 'wait_command': 3}
DEBUG: Received stdout: 
DEBUG: Received stderr: 14:49:49.147308 git.c:558               trace: exec: 'git-br'
14:49:49.147380 run-command.c:347       trace: run_command: 'git-br'
git: 'br' is not a git command. See 'git --help'.

Did you mean one of these?
    branch
    var

DEBUG: Call: git br; with env: {'HG': '/usr/bin/hg', 'SSH_AUTH_SOCK': '/tmp/ssh-KWPO5wntrdor/agent.1375', 'USER': 'ondra', 'GNUSTEP_FLATTENED': 'yes', 'LANG': 'C', 'GNUSTEP_HOST_CPU': 'x86_64', 'RUST_SRC_PATH': '/usr/src/rust/src/', 'XDG_CURRENT_DESKTOP': 'XFCE', 'COLORTERM': 'gnome-terminal', 'XDG_SEAT': 'seat0', 'PROMPT_DIRTRIM': '2', 'GIT_TRACE': '1', 'CLASSPATH': '/home/ondra/GNUstep/Library/Libraries/Java:/usr/lib/GNUstep/Libraries/Java', 'MAIL': '/var/spool/mail/ondra', 'GNUSTEP_LOCAL_ROOT': '/usr/Local', 'LIBRARY_COMBO': 'gnu-gnu-gnu', 'XDG_DATA_DIRS': '/usr/local/share:/usr/share', 'TERMINATOR_UUID': 'urn:uuid:a0affb3d-6a17-43bc-a273-00532f4912e8', 'GTK_MODULES': 'canberra-gtk-module', 'LD_LIBRARY_PATH': '/home/ondra/GNUstep/Library/Libraries:/usr/lib', 'STEAM_FRAME_FORCE_CLOSE': '1', 'GNUSTEP_HOST_VENDOR': 'unknown', 'GNUSTEP_HOST': 'x86_64-unknown-linux-gnu', 'ORBIT_SOCKETDIR': '/tmp/orbit-ondra', 'THEFUCK_DEBUG': 'true', 'MOZ_PLUGIN_PATH': '/usr/lib/mozilla/plugins', 'DBUS_SESSION_BUS_ADDRESS': 'unix:abstract=/tmp/dbus-L8UwioCx4H,guid=0e0bfbf1b8eb7be7b3c7d41055f27299', 'XDG_VTNR': '1', 'GLADE_PIXMAP_PATH': ':', 'GNUSTEP_HOST_OS': 'linux-gnu', 'GNUSTEP_NETWORK_ROOT': '/usr/Network', 'LOGNAME': 'ondra', 'XDG_SESSION_ID': 'c1', 'INFOPATH': '/usr/share/info::/home/ondra/GNUstep/Library/Documentation/info:', 'GUILE_LOAD_PATH': '/home/ondra/GNUstep/Library/Libraries/Guile:/usr/lib/GNUstep/Libraries/Guile', 'SESSION_MANAGER': 'local/x201:@/tmp/.ICE-unix/1363,unix/x201:/tmp/.ICE-unix/1363', 'LC_TIME': 'cs_CZ.UTF-8', 'XAUTHORITY': '/home/ondra/.Xauthority', 'QT_GRAPHICSSYSTEM': 'native', 'PS1': '\\[\x1b[1m\\]\\[\x1b[34m\\]\\w \\$ \\[\x1b(B\x1b[m\\]', 'TERM': 'xterm', 'LC_ALL': 'C', 'WINDOWID': '96468996', 'OLDPWD': '/srv/webroot-flowbox', 'GNUSTEP_MAKEFILES': '/usr/share/GNUstep/Makefiles', 'DISPLAY': ':0.0', 'HOME': '/home/ondra', 'GTK_IM_MODULE': 'xim', 'SHELL': '/bin/bash', 'SSH_AGENT_PID': '1376', 'XDG_CONFIG_DIRS': '/etc/xdg', 'PATH': '/home/ondra/.gem/ruby/2.2.0/bin:/home/ondra/GNUstep/Tools:/usr/local/sbin:/usr/local/bin:/usr/bin:/opt/android-sdk/platform-tools:/usr/lib/jvm/default/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl:/home/ondra/bin:/home/ondra/.composer/vendor/bin', 'GLADE_CATALOG_PATH': ':', 'GNUSTEP_SYSTEM_ROOT': '/usr/System', 'XDG_RUNTIME_DIR': '/run/user/1000', 'GNUSTEP_PATHLIST': '/usr/System:/usr/Network:/usr/Local:/home/ondra/GNUstep', 'SHLVL': '4', 'XDG_MENU_PREFIX': 'xfce-', 'PWD': '/srv/webroot-flowbox/public', 'GLADE_MODULE_PATH': ':', 'GNUSTEP_IS_FLATTENED': 'yes', 'DESKTOP_SESSION': 'Xfce Session', 'GNUSTEP_USER_ROOT': '/home/ondra/GNUstep', 'MATHEMATICA_HOME': '/opt/mathematica', '_': '/usr/bin/thefuck'}; took: 0:00:00.016147
DEBUG: Loaded rules: brew_install, brew_unknown_command, brew_upgrade, cargo, cargo_no_command, cd_correction, cd_mkdir, cd_parent, composer_not_command, cp_omitting_directory, cpp11, dirty_untar, dirty_unzip, django_south_ghost, django_south_merge, docker_not_command, dry, fix_alt_space, fix_file, git_add, git_branch_delete, git_branch_list, git_checkout, git_diff_staged, git_fix_stash, git_not_command, git_pull, git_pull_clone, git_push, git_push_pull, git_stash, go_run, grep_recursive, gulp_not_task, has_exists_script, heroku_not_command, history, java, javac, lein_not_task, ls_lah, man, man_no_space, mercurial, mkdir_p, no_command, no_such_file, open, pip_unknown_command, python_command, python_execute, quotation_marks, rm_dir, sed_unterminated_s, sl_ls, ssh_known_hosts, sudo, switch_lang, systemctl, test.py, tmux, tsuru_login, tsuru_not_command, unknown_command, vagrant_up, whois
DEBUG: Trying rule: brew_install; took: 0:00:00.000028
DEBUG: Trying rule: brew_unknown_command; took: 0:00:00.000012
DEBUG: Trying rule: brew_upgrade; took: 0:00:00.000012
DEBUG: Trying rule: cargo; took: 0:00:00.000012
DEBUG: Trying rule: cargo_no_command; took: 0:00:00.000012
DEBUG: Trying rule: cd_correction; took: 0:00:00.000014
DEBUG: Trying rule: cd_mkdir; took: 0:00:00.000014
DEBUG: Trying rule: cd_parent; took: 0:00:00.000012
DEBUG: Trying rule: composer_not_command; took: 0:00:00.000011
DEBUG: Trying rule: cp_omitting_directory; took: 0:00:00.000018
DEBUG: Trying rule: cpp11; took: 0:00:00.000012
DEBUG: Trying rule: dirty_untar; took: 0:00:00.000012
DEBUG: Trying rule: dirty_unzip; took: 0:00:00.000012
DEBUG: Trying rule: django_south_ghost; took: 0:00:00.000011
DEBUG: Trying rule: django_south_merge; took: 0:00:00.000012
DEBUG: Trying rule: docker_not_command; took: 0:00:00.000014
DEBUG: Trying rule: dry; took: 0:00:00.000015
DEBUG: Trying rule: fix_alt_space; took: 0:00:00.000014
DEBUG: Trying rule: fix_file; took: 0:00:00.000028
DEBUG: Trying rule: git_add; took: 0:00:00.000017
DEBUG: Trying rule: git_branch_delete; took: 0:00:00.000014
DEBUG: Trying rule: git_branch_list; took: 0:00:00.000017
DEBUG: Trying rule: git_checkout; took: 0:00:00.000014
DEBUG: Trying rule: git_diff_staged; took: 0:00:00.000017
DEBUG: Trying rule: git_fix_stash; took: 0:00:00.000016
DEBUG: Trying rule: git_not_command; took: 0:00:00.000016
DEBUG: Trying rule: git_pull; took: 0:00:00.000014
DEBUG: Trying rule: git_pull_clone; took: 0:00:00.000014
DEBUG: Trying rule: git_push; took: 0:00:00.000014
DEBUG: Trying rule: git_push_pull; took: 0:00:00.000014
DEBUG: Trying rule: git_stash; took: 0:00:00.000015
DEBUG: Trying rule: go_run; took: 0:00:00.000012
DEBUG: Trying rule: grep_recursive; took: 0:00:00.000015
DEBUG: Trying rule: gulp_not_task; took: 0:00:00.000015
DEBUG: Trying rule: has_exists_script; took: 0:00:00.000036
DEBUG: Trying rule: heroku_not_command; took: 0:00:00.000013
DEBUG: Trying rule: history; took: 0:00:00.158519
DEBUG: Trying rule: java; took: 0:00:00.000015
DEBUG: Trying rule: javac; took: 0:00:00.000012
DEBUG: Trying rule: lein_not_task; took: 0:00:00.000014
DEBUG: Trying rule: ls_lah; took: 0:00:00.000013
DEBUG: Trying rule: man; took: 0:00:00.000014
DEBUG: Trying rule: man_no_space; took: 0:00:00.000012
DEBUG: Trying rule: mercurial; took: 0:00:00.000013
DEBUG: Trying rule: mkdir_p; took: 0:00:00.000014
DEBUG: Trying rule: no_command; took: 0:00:00.000015
DEBUG: Trying rule: no_such_file; took: 0:00:00.001485
DEBUG: Trying rule: open; took: 0:00:00.000013
DEBUG: Trying rule: pip_unknown_command; took: 0:00:00.000012
DEBUG: Trying rule: python_command; took: 0:00:00.000018
DEBUG: Trying rule: python_execute; took: 0:00:00.000013
DEBUG: Trying rule: quotation_marks; took: 0:00:00.000012
DEBUG: Trying rule: rm_dir; took: 0:00:00.000013
DEBUG: Trying rule: sed_unterminated_s; took: 0:00:00.000012
DEBUG: Trying rule: sl_ls; took: 0:00:00.000012
DEBUG: Trying rule: ssh_known_hosts; took: 0:00:00.000016
DEBUG: Trying rule: sudo; took: 0:00:00.000044
DEBUG: Trying rule: switch_lang; took: 0:00:00.000013
DEBUG: Trying rule: systemctl; took: 0:00:00.000015
DEBUG: Trying rule: test.py; took: 0:00:00.000012
DEBUG: Trying rule: tmux; took: 0:00:00.000012
DEBUG: Trying rule: tsuru_login; took: 0:00:00.000012
DEBUG: Trying rule: tsuru_not_command; took: 0:00:00.000012
DEBUG: Trying rule: unknown_command; took: 0:00:00.000355
DEBUG: Trying rule: vagrant_up; took: 0:00:00.000013
DEBUG: Trying rule: whois; took: 0:00:00.000013
DEBUG: Matched rules: git_not_command, history
git branch
DEBUG: Total took: 0:00:00.389301
  dev
* history
  master
  meteogram
  testing

I've changed the config file from default to:

#
# The default values are as follows. Uncomment and change to fit your needs.
# See https://github.com/nvbn/thefuck#settings for more information.
#

require_confirmation = False
# wait_command = 3
# rules = []
# no_colors = False

(also kinda weird that it says "The default values are as follows", when "require_confirmation = False" was in the file by default (commented out) and fuck used True...)

MightyPork commented 9 years ago

For the record, after deleting .bash_history, I get:

DEBUG: Trying rule: history; took: 0:00:00.093100
...
DEBUG: Total took: 0:00:00.331774

no not a very big improvement (if my assumption that it uses .bash_history is right)

nvbn commented 9 years ago

Thanks for the data.

(also kinda weird that it says "The default values are as follows", when "require_confirmation = False" was in the file by default (commented out) and fuck used True...)

It's because it was generated by the old version of app, like 1.xx.

scorphus commented 9 years ago

@MightyPork said

(also kinda weird that it says "The default values are as follows", when "require_confirmation = False" was in the file by default (commented out) and fuck used True...)

When the file ~/.thefuck/settings.py already exists it's not regenerated/updated. I'm gonna work on that, merge/update it with new/changed confs.

Hipska commented 9 years ago

related to #353?

crimsdings commented 8 years ago

3 seconds lag on no fucks given

crimson@silverserver:~$ time fuck
No fucks given

real    0m3.252s
user    0m0.192s
sys     0m0.036s