Skip to content

RFC: lean core JSC #836

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

Merged
merged 4 commits into from
Mar 5, 2025
Merged

Conversation

Kudo
Copy link
Member

@Kudo Kudo commented Nov 28, 2024

writing a proposal to move JSC away from core

View the rendered RFC

@coolsoftwaretyler
Copy link

Is that 32mb of space saved on app bundles downloaded by end users?

@Kudo
Copy link
Member Author

Kudo commented Nov 28, 2024

Is that 32mb of space saved on app bundles downloaded by end users?

no, it's only on the developer's building host.

@coolsoftwaretyler
Copy link

Nice, still awesome to see! Love this.

@NickGerleman
Copy link

FYI @Saadnajmi


## Proposed Changes and Timeline

- Version 0.77: Remove the [`jsc-android` npm dependency](https://github.com/facebook/react-native/blob/2d337efc23c662143b3f39a6c994d80fec047054/packages/react-native/package.json#L132) from React Native and instead download the artifact from Maven Central. When using Hermes, downloading the unused npm dependency is unnecessary and removing it saves about 32 MB of uncompressed size.

Choose a reason for hiding this comment

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

Is this needed in 0.77 for 16KB page support?

Copy link
Member Author

Choose a reason for hiding this comment

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

yes, but if there's concern to cherry-pick facebook/react-native#47972 to 0.77. we can postpone the mavenCentral migration to 0.78. on 0.77 we still use jsc-android npm package for a newer version with android 16kb page support.

Copy link
Member

Choose a reason for hiding this comment

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

I'd rather go with 0.78.

Our take on 16K support is that it's Hermes first. Originally we were not even planning to include JSC for 16K support.


## Adoption strategy

We will offer a drop-in replacement with the `react-native-javascriptcore` npm package while maintaining JSC support in the core for two additional React Native releases to ensure a smooth transition.

Choose a reason for hiding this comment

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

If the boundary is jsi::Runtime, then I think that means there could be frequent updates needed against RN package.

The current structure has a nice benefit of keeping it up to date automatically, since it must build in line with JSI changes. But I think it means the project would need a long term maintainer to continue working. See microsoft/v8-jsi@4438466

Depending on whether there is a natural maintainer, the other option would look like a harder deprecation, which would still allow externally maintained runtimes to develop.

Copy link
Member Author

Choose a reason for hiding this comment

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

this is also the same problem for https://github.com/Kudo/react-native-v8. i can try to maintain the in my spare time (also love to have other maintainers from community)

maybe we need to include nightly testing from v8 and react-native-javascriptcore, so that we can catch jsi interface breaking changes and take action earlier.

Copy link
Member

Choose a reason for hiding this comment

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

We'd be happy to help with maintenance of that RN <-> JSC integration at Callstack

Copy link
Member Author

Choose a reason for hiding this comment

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

awesome! love the collaboration with someone from Callstack then.

@cipolleschi
Copy link

This align with our plans for next year. Not sure whether we can do it in 0.77, because the RC0 is already out and we want to reduce the stabilization time. We might have to shift the timeline by 1 release, but next year we plan to do a release every couple of months, so it shouldn’t delay it that much.

@cortinico I know you have thoughts on this! 😄

@Kudo
Copy link
Member Author

Kudo commented Nov 30, 2024

This align with our plans for next year. Not sure whether we can do it in 0.77, because the RC0 is already out and we want to reduce the stabilization time. We might have to shift the timeline by 1 release, but next year we plan to do a release every couple of months, so it shouldn’t delay it that much.

that's fair. we can also do npm jsc-android bump on 0.77 to support android 16kb page sizes first. and postpone the maven migration to 0.78. let me know which way you prefer.


## Proposed Changes and Timeline

- Version 0.77: Remove the [`jsc-android` npm dependency](https://github.com/facebook/react-native/blob/2d337efc23c662143b3f39a6c994d80fec047054/packages/react-native/package.json#L132) from React Native and instead download the artifact from Maven Central. When using Hermes, downloading the unused npm dependency is unnecessary and removing it saves about 32 MB of uncompressed size.
Copy link
Member

Choose a reason for hiding this comment

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

I'd rather go with 0.78.

Our take on 16K support is that it's Hermes first. Originally we were not even planning to include JSC for 16K support.

@robhogan
Copy link

I'm very supportive of removing JSC from the default download/build, but I'm concerned about the signal loss of moving all of our testing to out-of-band 3P integration tests.

How should we ensure that our JS changes don't break compatibility with JSC, including, say, @react-native/babel-preset and metro-runtime?

(Internally I've suggested react-native-fantom + running integration tests under headless JSC might be a solution to this but it involves retaining/downloading JSC in facebook/react-native CI.)

@Kudo
Copy link
Member Author

Kudo commented Feb 14, 2025

I'm very supportive of removing JSC from the default download/build, but I'm concerned about the signal loss of moving all of our testing to out-of-band 3P integration tests.

How should we ensure that our JS changes don't break compatibility with JSC, including, say, @react-native/babel-preset and metro-runtime?

(Internally I've suggested react-native-fantom + running integration tests under headless JSC might be a solution to this but it involves retaining/downloading JSC in facebook/react-native CI.)

at the beginning we can only run some basic e2e test with nightlies testing. for js regression that may impact to user, we may wait issue report until user find problems. that's more like what community js engine support like v8. if we really care about quality alignment for jsc, then maybe we should still keep jsc in core.

a good news on the other hand is, after moving out jsc to community. i plan to upgrade jsc-android to newer WebKit based version. that should support more modern js features.

Copy link
Member

@cortinico cortinico left a comment

Choose a reason for hiding this comment

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

LGTM 🚢

@Kudo Kudo merged commit df26823 into react-native-community:main Mar 5, 2025
@Kudo Kudo deleted the @kudo/lean-core-jsc branch March 5, 2025 07:11
huntie pushed a commit to huntie/react-native-discussions-and-proposals that referenced this pull request Apr 3, 2025
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.

7 participants