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

Setting fcitx-use-dbus to t leads to command lag #30

Open
et2010 opened this issue Mar 17, 2017 · 7 comments
Open

Setting fcitx-use-dbus to t leads to command lag #30

et2010 opened this issue Mar 17, 2017 · 7 comments

Comments

@et2010
Copy link

et2010 commented Mar 17, 2017

For detail, see here:
https://emacs-china.org/t/debug-emacs-performance-issue-ivy/2448/
In short:
Some serious lagging issue is caused by that option. I'm using spacemacs on Linux. When I turned that option to t, double tap on SPC will lag for 2 seconds before candidates list shows. When turned off, everything including fcitx.el works fine.

So I think I should raise an alarm here in case anyone else has the same issue.

@cute-jumper
Copy link
Owner

cute-jumper commented Mar 17, 2017

Yep. I can confirm that setting fcitx-use-dbus to t causes "lagging" in echo area. It makes the previous message stay in the echo area for a while. Since ivy uses minibuffer, it could be a problem. (But I think you don't need to wait. You can just start typing as soon as you hit SPC SPC.)

I am not sure why using dbus can cause the problem for the time being. I would suggest not setting that variable for now if you're using ivy.

@cute-jumper
Copy link
Owner

From what I can tell, this is caused by echo-keystrokes and dbus. Not sure what exact reason that leads to this problem. If you set echo-keystrokes to a larger number, say 1, or totally disable echoing keystrokes by setting it to 0, the problem seems to go. It could be a bug in dbus-call-method.

BTW, what is your echo-keystrokes value? Does the method I mentioned above work for you?

@et2010
Copy link
Author

et2010 commented Mar 18, 2017

Thanks for replying.

Yes, my echo-keystrokes is 0.02 and setting it to 0 or 1 works for me.

But I have some questions. Should I enable fcitx-use-dbus option on Linux in the first place? What would I miss if I set it to nil? It seems that it works just fine even without that option.

@cute-jumper
Copy link
Owner

cute-jumper commented Mar 18, 2017

Should I enable fcitx-use-dbus option on Linux in the first place?

No. This is just an optimization. Using dbus is faster in Linux, although the difference is not that big. You could choose not to set the variable to t, which is totally fine.

@et2010
Copy link
Author

et2010 commented Mar 18, 2017

Thanks for the clarification. I guess I'll keep that option and set echo-keystrokes to 1. Is there any side effects for doing this? I don't know anything about echo-keystrokes either except for what its docstring says which means very little for me. I just want to make sure I don't break something else this time 😂

@cute-jumper
Copy link
Owner

echo-keystrokes controls the delay between you press a key and the key shows in the echo area. So if you set it to 1, you need to wait for one second to see your previous keystroke in the echo area. If that's unacceptable, you don't need to set fcitx-use-dbus to t. Otherwise it would be fine.

The performance improvement of using dbus depends on your machine. You can measure the running time of fcitx--active-p-proc and fcitx--active-p-dbus (and there are other two pairs of functions with similar names) on your own machine to see the difference. Setting fcitx-use-dbus to t will use the functions with -dbus suffix. Whether to use dbus or not is just a personal preference.

I would update the README about fcitx-use-dbus to make people aware of the problem.

@et2010
Copy link
Author

et2010 commented Mar 18, 2017

Yes, dbus option is faster. On my computer, running:

(benchmark-run 100 (fcitx--active-p-proc))
(benchmark-run 100 (fcitx--active-p-dbus))

yeilds:

(0.343457615 0 0.0)
(0.202333871 0 0.0)

I'll keep using dbus and set echo-keystrokes to 1 for now.

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

No branches or pull requests

2 participants