Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

feat: switch core http to okhttp#10069

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Draft
edusperoni wants to merge1 commit intomain
base:main
Choose a base branch
Loading
fromfeat/okhttp
Draft

Conversation

edusperoni
Copy link
Contributor

WIP. Will fill details later.

Notes:

  • needs to use the alpha version of the runtime (fixes to kotlin/jvm methods)
  • need to wrap okhttp in an async task so we can process the body in the background
  • ideally be more lazy with the http processing
  • adapt the devtools agent to recieve okhttp results

other than doing some body decoding in the main thread, this implementation already covers all of the current API + cancellation. Ideeally we should have the web spec AbortController ready for this

@cla-botcla-botbot added the cla: yes labelOct 27, 2022
raw:result.raw,
toArrayBuffer: () => Uint8Array.from(result.raw.toByteArray()).buffer,
raw: raw,
toArrayBuffer: () => Uint8Array.from(raw.toByteArray()).buffer,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Uint8Array.from iterates over each element of the source array and copies it to the new array.

If you use pass ajava.nio.ByteBuffer as the argument it'll create the TypedArray from a pointer (O(1) performance and no extra memory allocation).

Creating a buffer from 1MB of data takes about ~700ms, wrapping it in ajava.nio.ByteBuffer takes only 3ms

toArrayBuffer:()=>{constarr=raw.toByteArray();constbb=java.nio.ByteBuffer.wrap(arr);constbuffer=ArrayBuffer.from(bb);returnbuffer;},

triniwiz reacted with thumbs up emoji
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@mukaschultzemukaschultzemukaschultze left review comments

Assignees
No one assigned
Labels
Projects
None yet
Milestone
9.0
Development

Successfully merging this pull request may close these issues.

3 participants
@edusperoni@mukaschultze@NathanWalker

[8]ページ先頭

©2009-2025 Movatter.jp