Skip to content

feat: add document type support and performance improvements for xhr#710

Merged
ACTCD merged 9 commits into
mainfrom
api-xhr-improvements
Sep 6, 2024
Merged

feat: add document type support and performance improvements for xhr#710
ACTCD merged 9 commits into
mainfrom
api-xhr-improvements

Conversation

@ACTCD

@ACTCD ACTCD commented Sep 5, 2024

Copy link
Copy Markdown
Collaborator

fixes:


feats:

  • Add support responseType: "document" for GM.xmlHttpRequest
  • New non-standard contentType key in GM.xmlHttpRequest response object

perfs:

Optimized for transmission and processing of various data types.

For example the performance improvement of responseType: "blob", attached is a non-rigorous and non-final test screenshot of 1000 times of 1MB data processing respectively, with roughly a 5x improvement in efficiency, and a significant reduction in CPU and memory usage.

blob-perf

For convenience, and is also required when decode the response in content scripts side.
Avoid the calculation amount, memory consumption and data expansion caused by encoding, decoding and fetch.
Avoid double memory consumption and transfer costs.
Only add implementation, not enable, to avoid unnecessary calculations, and this legacy behavior is not recommended, users should explicitly use `responseType: "document"` to obtain it.
Use `TypedArray` directly without constructing a new `Blob`.
@ACTCD ACTCD marked this pull request as ready for review September 6, 2024 04:46
@ACTCD ACTCD merged commit 75ee89b into main Sep 6, 2024
@ACTCD ACTCD deleted the api-xhr-improvements branch September 6, 2024 04:47
@ACTCD ACTCD restored the api-xhr-improvements branch September 6, 2024 04:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

GM.info.version is missing GM.xmlHttpRequest does not support responseType: "document"

2 participants