using WebAssembly
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 12.4k
- Forks
- 2.4k
- PR merge metrics
- No merged PRs in 30d
Description
> WebAssembly or wasm is a new portable, size- and load-time-efficient format suitable for compilation to the web.
http://webassembly.org/
A couple months ago [WebAssembly](http://webassembly.org/) reached cross-browser consensus. This means it's [shipping in the next or current versions of most major browsers](https://caniuse.com/#feat=wasm). The support isn't wide enough yet, but this might be a good time to start talking about whether we want to use it, how we could use it and what the timeline on that might look like.
Why?
Theoretically we could compile a modified mapbox-gl-native to WebAssembly and we could have a single core codebase for all our platforms. No more porting between -js and -native and struggling to keep things in sync. There *might* also be performance benefits.
I don't have any answers. Just questions:
### Browser support
- How many versions back to we need to support browsers? (only the current ios safari? or last two versions? three?)
- How soon do we think there will be support for all the browsers/versions we need to support?
- Is compilation to unoptimized asm.js a viable fallback for IE?
- Could we maintain the current -js version and only add new features / spec changes for browsers that do support wasm?
### Switching process
- Would we want to switch all at once?
- Or by gradually replacing pieces (eg label collision calculations) with wasm versions?
### Developer friendliness
- Does the necessary debug tooling exist?
- How slow would the compile-refresh-test cycle be?
- Does having only a C++ version of the core make the barrier to entry higher?
### Architecture
- how would we deal with the different concurrency models in browsers and native platforms?
- how much would the code in -native need to change to make it suitable for compilation to wasm?
### Performance
- Is the runtime performance fast enough?
- Is the compiled binary small enough?
- Is there a significant cost to calling into wasm? Is this a concern for any of our apis?
- What is the performance of asm.js like? What about in browsers that don't support asm.js optimization, like IE?
### Also
- Would the benefits even be worth the large effort this would take?
@mapbox/gl-core, **is this something we should start thinking about now? Not yet?**
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reviewing the mapbox-gl-native and current -js architecture, along with the linked WebAssembly browser-support resources and the questions in this issue. Done would require a documented decision on feasibility, browser support, architecture, performance, and whether pursuing WebAssembly is worth the effort.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp, wasm
- Domain
- frontend, web-dev
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 22/100