Skip to content

v1.11.0

Latest

Choose a tag to compare

@amatsagu amatsagu released this 01 Nov 20:36
· 3 commits to master since this release

Tempest v1.11.0 is a major performance and modernization release. This update completes the framework's migration to Go's modern encoding/json/v2 engine, replaces zlib-compression with zstd-stream compression (which is much more performant), adds buffer pooling and response streaming across the REST and Gateway hot paths to reduce number of memory allocations and overhauls interaction dispatch with zero-copy pointer semantics (again, sorry - we had that in past).

What's Changed

  • Fully transitioned all internal serialization and deserialization of json objects to Go's encoding/json/v2 and encoding/json/jsontext, providing anywhere from 5% to 15% faster JSON throughput but what's more important: we noticed lower CPU overhead and memory usage in every single benchmark and test we've made.
  • Standardized omitzero struct flag across all discord models for numeric IDs, counts, bitset flags, enums, boolean options, etc. preventing accidental serialization of invalid zero values (some of that was required due to small behavior change in json/v2).
  • Further optimized hot paths and struct definitions that caused extra memory allocations:
    • Snowflakes now implement encoding.TextAppender (AppendText) and UnmarshalText, making them faster and cheaper to parse.
    • Rate limiter now better handles /interactions/ routes, making them much cheaper at cost of slightly higher base/idle memory use.
    • User struct can be now parsed without extra reflection but as side effect: user.DisplayName() is now a function instead value.
    • Added zero-allocation discriminator scanners (peekInteractionType, peekComponentType) using jsontext.Decoder to inspect payloads in a single forward pass without unmarshaling into intermediate maps.
    • Improved signature verification on incoming HTTP requests making them do less allocations.
    • Converted CommandInteraction, ComponentInteraction, ModalInteraction, and AutoCompleteInteraction to pointer dispatch (*CommandInteraction), eliminating struct copying and heap escapes across goroutines.
    • Specialized interaction wrappers now embed the base Interaction struct by value instead of by pointer, eliminating an extra heap allocation per interaction.
    • Added global sync.Pool instances for *bytes.Buffer and *bytes.Reader to Rest, eliminating heap allocations for request bodies, and stream responses directly via json.UnmarshalRead.
  • Upgraded GatewayClient compression from zlib-stream to streaming zstd (Compression / ZstdCompression) powered by klauspost/compress/zstd. The decoder is reused across reconnects, cutting incoming Gateway memory and CPU overhead by up to ~70%.
  • Incoming and outgoing WebSocket frames now stream directly using zero-copy jsontext.Value, and read deadlines are refreshed adaptively to reduce deadline churn.
  • Hardened RateLimiter bucket synchronization to honor learned windows, preventing 429 retry loops under high concurrency, and restricted unsafe retries on non-idempotent endpoints.
  • Added uniform resolved entity accessors (itx.Data.Resolved.Resolve*(id)), modal component getters, and helper to instantly acknowledge & update parent component messages.
  • Updated Discord API models with latest Discord docs, modernized the example bot, and standardized doc comments across the codebase.
  • Fixed FindInteractiveComponent prematurely stopping on the first child instead of recursively inspecting all children thanks by @Bertie690 in #71.

Full Changelog: v1.10.5...v1.11