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

Update WASM binary and Land WASM rust sources in this repository #465

Merged
merged 4 commits into from
Nov 2, 2022

Conversation

ochameau
Copy link
Contributor

Today, the rust sources used to generate lib/mappings.wasm are hosted on:
https://github.com/fitzgen/source-map-mappings/
This looks unofficial, whereas that's where the sources come from and last binary was built from that repo.

It would be easier to fold the rust sources in this repo to ease contributions to it, while increasing visibility to the rust sources.

While we are at landing sources in-tree, it would also be nice to refresh the wasm binary by building it with latest rust version.
The current binary has been being in 2018 and is no longer reproducible.

In an effort to help reproduce the same wasm file, here is the environment from which I built it:

$ cargo -V
cargo 1.64.0 (387270bc7 2022-09-16)
$ rustup -V
rustup 1.25.1 (bb60b1e89 2022-07-12)
info: This is the version for the rustup toolchain manager, not the rustc compiler.
info: The currently active `rustc` version is `rustc 1.64.0 (a55dd71d5 2022-09-19)`

Using instruction documented here.

@coveralls
Copy link

Pull Request Test Coverage Report for Build 607

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 88.713%

Totals Coverage Status
Change from base Build 606: 0.0%
Covered Lines: 827
Relevant Lines: 911

💛 - Coveralls

@coveralls
Copy link

coveralls commented Oct 18, 2022

Pull Request Test Coverage Report for Build 613

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 88.713%

Totals Coverage Status
Change from base Build 606: 0.0%
Covered Lines: 827
Relevant Lines: 911

💛 - Coveralls

Copy link
Collaborator

@jkrems jkrems left a comment

Choose a reason for hiding this comment

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

RSLGTM on the Rust and Python code (assuming that it's just copying existing work). Left some questions in metadata files and license updates.

@@ -0,0 +1,2 @@
README.md -diff -merge
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is this redundant with the top-level attributes?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh yes I forgot to remove it after folding it into the main one.

@@ -0,0 +1,27 @@
language: rust
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should this be removed?

@@ -0,0 +1,201 @@
Apache License
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should the top-level LICENSE file be updated to ensure people are aware of the mixed licensing that applies to the repo?

Semi-related: Should we reach out to Nick and Tom to check if relicensing to BSD is in the cards (not for this CL but in the near future)? I assume it's a single-ish author so far which makes it still relatively easy.

Copy link
Contributor Author

@ochameau ochameau Oct 18, 2022

Choose a reason for hiding this comment

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

I'll reach out before landing. I suspect they changed the main repo license without changing the wasm one.

Copy link
Contributor

Choose a reason for hiding this comment

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

I am happy to relicense the rust code as BSD.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks a lot for chiming in Nick!

@ochameau
Copy link
Contributor Author

RSLGTM on the Rust and Python code (assuming that it's just copying existing work).

Yes I copied master branch as is.

@ochameau ochameau requested a review from bomsy October 18, 2022 17:57
ochameau added a commit to ochameau/source-map that referenced this pull request Oct 19, 2022
Following agreement from Nick on mozilla#465, align source-map-mappings with source-map license.
@ochameau
Copy link
Contributor Author

I removed the license files from wasm folder, updated various files to mention BSD license, and updated github repo reference to mozilla's source-map one.

ochameau added a commit to ochameau/source-map that referenced this pull request Oct 19, 2022
Following agreement from Nick on mozilla#465, align source-map-mappings with source-map license.
CONTRIBUTING.md Outdated
@@ -152,11 +152,11 @@ $ rustup toolchain install nightly
$ rustup target add wasm32-unknown-unknown --toolchain nightly
```

Next, clone the Rust source used to create `lib/mappings.wasm`:
Move to wasm sources folder:

```
$ git clone https://github.com/fitzgen/source-map-mappings.git
Copy link
Collaborator

@bomsy bomsy Oct 19, 2022

Choose a reason for hiding this comment

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

Should this line be removed now that we have the mappings in this repo?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes, forgot to remove the command line!

# Contributing to `source-map-mappings`

Hi! We'd love to have your contributions! If you want help or mentorship, reach
out to us in a GitHub issue, or ping `fitzgen` in [#rust on irc.mozilla.org](irc://irc.mozilla.org#rust)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is this irc channel still valid?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

irc server is down, I removed it with the new matrix channel.

@@ -0,0 +1,33 @@
# `source-map-mappings`
Copy link
Collaborator

Choose a reason for hiding this comment

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

Sould this become wasm-mappings?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No, the rust package name is still source-map-mappings (you can see it referenced in cargo files)

Copy link
Collaborator

@bomsy bomsy left a comment

Choose a reason for hiding this comment

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

LGTM! Just had comments/questions about documentation updates
Thanks

ochameau added a commit to ochameau/source-map that referenced this pull request Oct 19, 2022
Following agreement from Nick on mozilla#465, align source-map-mappings with source-map license.
@ochameau
Copy link
Contributor Author

I've also updated the patch to ensure using latest master revision of source-map-mappings.
So that we are using fitzgen/source-map-mappings@197660f here, with the few cleanups and renames.

ochameau added a commit to ochameau/source-map that referenced this pull request Oct 19, 2022
Following agreement from Nick on mozilla#465, align source-map-mappings with source-map license.
@ochameau
Copy link
Contributor Author

With the latest changeset refreshing the wasm binary with latest version of rust, there seem to be a significant performance improvement:
https://treeherder.mozilla.org/perfherder/comparesubtest?originalProject=try&newProject=try&newRevision=340b70fc0526e767e8657b8f41749240d14d2908&originalSignature=4081483&newSignature=4081483&framework=12&originalRevision=b4fda98f266ca9b53c8f3962d6e92a9d68e32b57&page=1&showOnlyImportant=1
image
(I ported the existing perf test from bench folder to firefox CI)

Copy link
Member

@eemeli eemeli left a comment

Choose a reason for hiding this comment

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

Looks good, provided that the contribution guidelines and the README link to them is fixed.

@@ -0,0 +1,87 @@
# Contributing to `source-map-mappings`
Copy link
Member

Choose a reason for hiding this comment

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

The contents of this file should be merged into the root CONTRIBUTING.md. It's not really tenable to e.g. apply a separate CoC to a part of a repo as this implies.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I dropped the redundant content, but kept it for wasm specifics instructions.
I may consider moving "updating mappings.wasm" here?
I find it nice to keep the rust/wasm part of the codebase still contained in this subfolder.

Copy link
Member

Choose a reason for hiding this comment

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

Yeah, that makes sense.

wasm-mappings/src/lib.rs Outdated Show resolved Hide resolved
wasm-mappings/README.tpl Outdated Show resolved Hide resolved
@ochameau
Copy link
Contributor Author

When testing against Babel and React sourcemaps there is also significant improvements when running on Firefox:
image
Up to 20% faster when parsing the babel sourcemap and between 5% to 7% faster on mapping generated to original locations.

ochameau added a commit to ochameau/source-map that referenced this pull request Oct 25, 2022
Following agreement from Nick on mozilla#465, align source-map-mappings with source-map license.
The WASM sources used to be hosted on another personal repo:
  https://github.com/fitzgen/source-map-mappings/

This patch inlines this repo into wasm-mappings folder so that it is easier
to contribute to WASM sources and see the impact of modifications made to it.
This also clarify what are the sources of the binary wasm file (lib/mappings.wasm).

I picked current master branch revision: 197660faf3dd1167c643797a5ed62cb687482c54.

This isn't a straight merge of the original repo changeset.
License has been changed to BSD3, readme template has been dropped, documentation
has been updated and references to source-map-mappings have been revised.
Following agreement from Nick on mozilla#465, align source-map-mappings with source-map license.
The last generated wasm file was built in 2018 and it is very challenging to rebuild it the exact same.
Rebuild it using latest rust binary and libraries:
  cargo 1.64.0 (387270bc7 2022-09-16)
  rustc 1.64.0 (a55dd71d5 2022-09-19)
  rustup 1.25.1 (bb60b1e89 2022-07-12)
@ochameau
Copy link
Contributor Author

ochameau commented Nov 2, 2022

I had to request the enabling of actions-rs/toolchain@v1 on mozilla repos for the wasm github actions:
https://bugzilla.mozilla.org/show_bug.cgi?id=1797457
Otherwise the github actions for wasm were failing on rust tests.

Now everything is green and good to go!

@ochameau ochameau merged commit 56c1617 into mozilla:master Nov 2, 2022
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.

6 participants