SIGN IN SIGN UP
facebook / react-native UNCLAIMED

A framework for building native applications using React

0 0 0 C++

Bump chunk size for android (#54301)

Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/54301

# Changelog: [Internal]

Previously, we would read every single kilobyte and do Java -> C++ call with `jni`.

For big objects, like source maps, this means that we were doing at least 1024 calls for a single megabyte of incoming data. From my observations, some source maps on Twilight could reach 30Mb+.

There is a trade-off between how much of memory we want to allocate while reading a stream and a runtime. I didn't notice any differences while changing the chunk size from 8Kb to 1Mb and some values in between; in the end it purely depends on the OkHttp's or Okio's implementation of the stream, looks like it uses 8Kb as a chunk size by default:
{F1983042734}

Reviewed By: huntie

Differential Revision: D85652217

fbshipit-source-id: 68474f0b7eece13a0a1c8ea9e617b99a26d81ff9
R
Ruslan Lesiutin committed
728dfef37ac4e073086c2d3af665c9566f36e2f2
Parent: 7164f96
Committed by meta-codesync[bot] <215208954+meta-codesync[bot]@users.noreply.github.com> on 11/4/2025, 5:04:31 PM