Skip to content

Upgrade or patch Penpal to avoid plugin message latency #55

Description

@Convincible

datocms-plugin-sdk 2.2.5 resolves Penpal 4.1.1.

This version of Penpal inherently produces an issue that can compound to plugins exhibiting significant/visible input lag.

In Penpal 4.1.1, its steady-state call and reply handlers access event.data before validating event.source and event.origin. In Chromium, qualifying cross-origin messages can consequently trigger expensive deserialisation in every plugin iframe. In our traces, these receivers averaged roughly 5–6 ms per callback and caused noticeable typing latency.

The issue appears resolved in Penpal 7+, however I appreciate that upgrading to that isn't trivial.

Our own solution is to maintain a local patch that checks source and origin before accessing data. This removed the associated V8.DeserializeIsolate and V8.DeserializeContext work, reduced average receiver time to under 1 ms, and improved typing lag enormously.

The general resolution would be either to:

  • migrate to the newer Penpal version; or
  • apply an equivalent patch in the SDK

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions