Skip to content

feat: various caching & memory optimizations#222

Draft
Snazzah wants to merge 11 commits intoprojectdysnomia:devfrom
Snazzah:feat/caching
Draft

feat: various caching & memory optimizations#222
Snazzah wants to merge 11 commits intoprojectdysnomia:devfrom
Snazzah:feat/caching

Conversation

@Snazzah
Copy link
Contributor

@Snazzah Snazzah commented Sep 2, 2025

This should allow for not using the Client.channelGuildMap, Client.threadGuildMap, and Client.guildShardMap when caching.disableMaps is on.

Some caveats:

  • Obviously getChannel will do linear searching now, but this can be skipped with guild hinting. getChannel now has a guildIDHint parameter for getting that specific guild rather than searching all of them. Which has some caveats:
    • editChannelPosition's option param has guildIDHint, it's channel's corresponding function will use it.
    • Same for joinVoiceChannel and leaveVoiceChannel, but leaveVoiceChannel has it's hinting in a new parameter.
    • ThreadMember's construction to find the guild will do linear searching, sad.
  • Many of the shard events that use getChannel either now hint at the guild or just gets the guild directly.

Not fully tested yet.

@github-project-automation github-project-automation bot moved this to Untriaged in To-do Sep 2, 2025
Makes getChannel() fall back to linear search through all guilds in case guildIDHint is somehow incorrect (should happen only from user-land).
@TTtie TTtie added the type: enhancement New feature or request label Sep 2, 2025
@TTtie TTtie moved this from Untriaged to WIP in To-do Sep 2, 2025
@TTtie TTtie added this to the 0.2.x milestone Sep 2, 2025
@TTtie TTtie modified the milestones: 0.2.x, next, 0.3.0 Oct 17, 2025
@Snazzah Snazzah changed the title feat: allow for disabling channel maps feat: various caching & memory optimizations Dec 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type: enhancement New feature or request

Projects

Status: WIP

Development

Successfully merging this pull request may close these issues.

2 participants