Skip to content

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

Merged
ochameau merged 4 commits into
mozilla:masterfrom
ochameau:wasm-sources
Nov 2, 2022
Merged

Update WASM binary and Land WASM rust sources in this repository#465
ochameau merged 4 commits into
mozilla:masterfrom
ochameau:wasm-sources

Conversation

@ochameau

Copy link
Copy Markdown
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
Copy Markdown

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%

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

💛 - Coveralls

@coveralls

coveralls commented Oct 18, 2022

Copy link
Copy Markdown

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%

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

💛 - Coveralls

@hybristhybrist left a comment

Copy link
Copy Markdown
Collaborator

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.

Comment threadwasm-mappings/.gitattributes Outdated
@@ -0,0 +1,2 @@
README.md -diff -merge

Copy link
Copy Markdown
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
Copy Markdown
ContributorAuthor

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.

Comment threadwasm-mappings/.travis.yml Outdated
@@ -0,0 +1,27 @@
language: rust

Copy link
Copy Markdown
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?

Comment threadwasm-mappings/LICENSE-APACHE Outdated
@@ -0,0 +1,201 @@
Apache License

Copy link
Copy Markdown
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.

@ochameauochameauOct 18, 2022

Copy link
Copy Markdown
ContributorAuthor

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
Copy Markdown
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
Copy Markdown
ContributorAuthor

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
Copy Markdown
ContributorAuthor

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 bomsyOctober 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
Copy Markdown
ContributorAuthor

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.
Comment threadCONTRIBUTING.md Outdated
Move to wasm sources folder:

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

@bomsybomsyOct 19, 2022

Copy link
Copy Markdown
Contributor

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
Copy Markdown
ContributorAuthor

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!

Comment threadwasm-mappings/CONTRIBUTING.md Outdated
# 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
Copy Markdown
Contributor

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
Copy Markdown
ContributorAuthor

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
Copy Markdown
Contributor

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
Copy Markdown
ContributorAuthor

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)

@bomsybomsy left a comment

Copy link
Copy Markdown
Contributor

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
Copy Markdown
ContributorAuthor

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
Copy Markdown
ContributorAuthor

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)

@eemelieemeli left a comment

Copy link
Copy Markdown
Member

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
Copy Markdown
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
Copy Markdown
ContributorAuthor

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
Copy Markdown
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.

Comment threadwasm-mappings/src/lib.rs Outdated
Comment threadwasm-mappings/README.tpl Outdated
@ochameau

Copy link
Copy Markdown
ContributorAuthor

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
Copy Markdown
ContributorAuthor

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:masterNov 2, 2022
Sign up for freeto 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

@ochameau@coveralls@fitzgen@hybrist@eemeli@bomsy