Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 9 commits into from
Sep 6, 2024

Conversation

ACTCD
Copy link
Collaborator

@ACTCD ACTCD commented Sep 5, 2024

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
1 check passed
@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