Skip to content

Performance

KrispPurg edited this page Jul 16, 2020 · 2 revisions

Maintaining a large discord bot or even a bot in a large guild with good performance can be hard sometimes.

With gateway intents this solution can be solved, but there is a possibility that there is a problem

What should I do to improve performance?

  • I would recommend you to try to disable caching you do not need or make your own type of cache, such as working with raw data events.

    Object constructors are here in objects for a reason. (use the on_dispatch event)

  • If you are on a lot of guilds like 600 for example, you could try to shard your discord bot (read the sharding wiki for more information), that way it will at least split the events to different connections.

  • There is a new feature in Nim which is called ARC and ORC, though it would be risky since they are knew and can potentially cause bugs. Read more here.

  • You can set your message size limit (in bytes), which prevents large messages from being added to the cache; limits included too.

Clone this wiki locally