fanyi.el icon indicating copy to clipboard operation
fanyi.el copied to clipboard

Too slow

Open seagle0128 opened this issue 2 years ago • 4 comments

Thanks for this great extension!

I tried fanyi, youdao-dictionary and go-translate, and looks fanyi is the slowest. It's better if fanyi can return the results faster.

seagle0128 avatar Jun 23 '22 17:06 seagle0128

The fanyi buffer is beautiful. However, I haven't used this package for quite a long while because of its slowness. I have similar keybindings for fanyi and youdao-dictionary. Sometimes I call fanyi by chance. It can take more than 5 seconds to get the results. I profiled Emacs when I used fanyi. But I don't have a clue to what might be wrong.

167  39% - ...
166  39%    Automatic GC
1   0%  + url-http-create-request
93  21% - #<compiled 0x188053a5ecc0f91b>
93  21%  - url-retrieve
93  21%   - url-retrieve-internal
91  21%    - url-https
91  21%     - url-http
91  21%      - url-http-find-free-connection
91  21%       - url-open-stream
91  21%        - open-network-stream
91  21%         - network-stream-open-tls
91  21%          - open-gnutls-stream
2   0%           - gnutls-boot-parameters
2   0%            + gnutls-trustfiles
1   0%    + url-generic-parse-url
54  12% + redisplay_internal (C function)
42   9% + command-execute
29   6% + url-http-generic-filter
13   3% + evil-escape-pre-command-hook
12   2% + timer-event-handler
4   0% + substitute-command-keys
4   0% + nsm-verify-connection
2   0% + eldoc-pre-command-refresh-echo-area
1   0%   mode-local-post-major-mode-change
1   0% + undo-auto--add-boundary
1   0% + flycheck-handle-signal

fountainer avatar Jun 24 '22 15:06 fountainer

See #19 for a quick profile. I will then update README to mention how to profile fanyi.el.

condy0919 avatar Jun 28 '22 07:06 condy0919

I don't think the troubleshooting mentioned in #19 is helpful. I'd suggest to experience both fanyi and go-translate/youdao-dictionary.

seagle0128 avatar Jun 28 '22 08:06 seagle0128

go-translate/youdao-dictionary looks pretty fast!

But go-translate/youdao-dictionary directly uses the translation API, fewer texts are transferred than fetching the entire html pages that fanyi.el does. It needs to do some investigations, the detailed reason will be posted here later.

condy0919 avatar Jun 28 '22 09:06 condy0919