torhve / weechat-matrix-protocol-script

A WeeChat script in Lua that implements the matrix.org chat protocol
349 stars 52 forks source link

matrix.lua makes weechat slow #50

Open vext01 opened 7 years ago

vext01 commented 7 years ago

Hi,

I've bee frustrated with the performance of weechat recently, and I've pinpointed it to matrix.lua. This script makes the UI laggy.

Are there any low-hanging optimisations or workarounds I can try?

Thanks

torhve commented 7 years ago

The matrix protocol makes an extreme number of HTTP requests, especially for large rooms. WeeChat was not designed to handle this as smooth as it could have been.

I have introducted a new setting

/set plugins.var.lua.matrix.presence_filter on

This setting will prevent synapse from sending presence events, and ephemeral events, like typing notification and read notices. This will limit the number of HTTP requests a lot. Please try and see if it helps.

The plan for the future is use a (web)socket transport instead of regular HTTP, which WeeChat supports better. But there is no official such transport yet, only proof of concept proxy.

vext01 commented 7 years ago

Sadly the UI is still sluggish with this option set. Closing the 'Matrix HQ' buffer helps a lot, but I would like to be in that room ;)

torhve commented 7 years ago

Are you using nicklist? If so, try without it.

vext01 commented 7 years ago

I'm not using nicklist.

kyrias commented 7 years ago

When protocols require a lot of requests like Matrix it should really be done from a separate thread, though I'm not sure if Lua/WeeChat makes that easy to do.

(Though now I feel like trying to implement a plugin version of this script, hah.)

torhve commented 7 years ago

the script doesn't do any http calls on it's own, I request URLs using weechat's async API for it, so it's that API that is freezing the UI.

kyrias commented 7 years ago

Ah, that's... disturbing. Might be worth bringing up on the weechat bugtracker.

strk commented 7 years ago

Are you caching DNS lookups?

roel0 commented 7 years ago

This script causes 100%Cpu usage on one core, which makes it unusable.

NickHu commented 7 years ago

Can confirm that disabling nicklist seems to make it usable/better.

strk commented 7 years ago

This is duplicate of #30