Skip to content
This repository was archived by the owner on May 3, 2022. It is now read-only.
This repository was archived by the owner on May 3, 2022. It is now read-only.

Optimizations for clients & servers #237

@Raynos

Description

@Raynos

I'm working on a fat heavy branch and I'm keeping notes of optimizations that we should backport everywhere

  • use this inside constructors, v8 literally pattern detects for this.foo = x and NOT self.foo =x
  • use bucket based OutPending() data structure instead of naive dictionary
  • use write ahead to avoid calling RW.byteLength. buf.write() returns bytes written, and with our offset tracking we can always backtrack and set frame.writeUInt32BE(finalOffset, 0)
  • use TCP_WRAP if process.version === 0.10.32 to go 30% faster.
  • use 512kb SlowBuffer pool instead of new Buffer()
  • use the arg2str or arg2buf trick.
  • use the caching headers + writeHead() & writeTail() trick.
  • use utf8slice and utf8write.
  • avoid reading arg1 as slice when we only need string anyway.
  • thread offset through frame parsing to avoid SlowBuffer#slice where possible.

cc @jcorbin @rf @kriskowal

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions