etherpad-lite/src
John McLear 63f95d6029
perf: avoid throw-as-control-flow in SessionManager hot path (#7756) (#7775)
CPU profile of the SUT at the 100-400 author dive sweep
(load-test workflow run 25956384097) attributed about 6% of total
process CPU to the throw + catch around getSessionInfo:

  - ~1.82% to `new CustomError('sessionID does not exist', 'apierror')`
    construction (stack trace capture)
  - ~4.12% downstream, via the catch block's `console.debug(...)`
    routed through log4js -> sendToListeners -> sendLogEventToAppender

Both call sites (`findAuthorID` on every CLIENT_READY, and
`listSessionsWithDBKey` on session listing) immediately caught
`apierror` and discarded it. The public `exports.getSessionInfo`
contract still has to throw for the HTTP API (returning code:1 for
missing sessionID), so introduce a private `getSessionInfoOrNull`
helper that returns null and have the hot-path callers use it
directly. `exports.getSessionInfo` is kept as a thin wrapper that
preserves the existing throw semantics.

No behaviour change for the HTTP API — sessionsAndGroups.ts test
file (32 cases, including "getSessionInfo of deleted session"
expecting code:1) passes unchanged.

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-07-27 21:03:21 +02:00
..
locales Localisation updates from https://translatewiki.net. 2026-07-27 14:04:23 +02:00
node perf: avoid throw-as-control-flow in SessionManager hot path (#7756) (#7775) 2026-07-27 21:03:21 +02:00
static Migrate server to TypeScript 7 (tsgo) (#8039) 2026-07-27 21:00:32 +02:00
templates fix(pad): keep token-less Delete pad reachable without pad-wide settings (#7959) (#7960) 2026-06-17 15:18:23 +01:00
tests fix(editor): PageDown/PageUp now advance on consecutive long wrapped lines (#7555) 2026-07-27 21:03:15 +02:00
.eslintrc.cjs Feat/admin react (#6211) 2024-03-09 23:07:09 +01:00
ep.json feat(updater): tier 2 — manual-click update from /admin/update (#7607) (#7704) 2026-05-10 09:00:07 +01:00
etherpad_icon.svg Change favicon to be closer to new style 2020-04-19 18:20:21 +02:00
package.json Migrate server to TypeScript 7 (tsgo) (#8039) 2026-07-27 21:00:32 +02:00
playwright.config.ts test(playwright): un-skip ep_headings2 spec under WITH_PLUGINS (#7634) 2026-04-30 06:12:23 +01:00
README.md remove one less warning during install by having a readme placeholder 2013-02-10 03:04:08 +00:00
tsconfig.json 🩹 — Avoid duplicate key "types" in tsconfig (#7610) 2026-04-28 13:06:43 +08:00
vitest.config.ts Feat/changeset ts (#6594) 2024-08-18 12:14:24 +02:00
web.config Added typescript to etherpad 2024-02-05 21:13:02 +01:00

Ignore this file and see the file in the base installation folder