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

WASM: Fast array implementation #2423

Merged
merged 7 commits into from Feb 17, 2017
Merged

Conversation

Cellule
Copy link
Contributor

@Cellule Cellule commented Jan 27, 2017

Closes #1888
Related #2100

This PR implements the fast array (aka 8GB array) for WebAssembly on Windows x64.
I have put the feature under a flag (turned on by default) to help with testing and possibly debugging future issues.
This creates a new type of ArrayBuffer, WebAssemblyArrayBuffer which, since the creation is controlled within WebAssembly, always allocate the buffer in virtual memory regardless of size or asm.js constraint.

Performance data from the console version of the unity benchmark

unity                  Left score        Right score       ∆ Score   ∆ Score %  Comment
---------------------  ----------------  ----------------  --------  ---------  --------
Overall                 63168.42 ±0.12%   73064.71 ±0.12%   9896.30     15.67%  Improved
Mandelbrot Script       68003.40 ±0.14%   68933.23 ±0.17%    929.83      1.37%  Improved
Instantiate & Destroy   20400.44 ±0.11%   23666.88 ±0.07%   3266.43     16.01%  Improved
CryptoHash Script      130857.13 ±0.18%  160959.62 ±0.07%  30102.49     23.00%  Improved
Animation & Skinning      394.56 ±0.20%     454.41 ±0.33%     59.86     15.17%  Improved
Asteroid Field          16249.17 ±0.20%   19167.92 ±0.18%   2918.75     17.96%  Improved
Physics Spheres          1221.60 ±0.09%    1373.78 ±0.06%    152.18     12.46%  Improved
Physics Spheres          1221.60 ±0.09%    1373.78 ±0.06%    152.18     12.46%  Improved
2D Physics Boxes         1540.40 ±0.21%    1700.38 ±0.10%    159.98     10.39%  Improved
---------------------  ----------------  ----------------  --------  ---------  --------
Total                    8207.50 ±0.15%    9331.11 ±0.13%   1123.61     13.69%  Improved

This change is Reviewable

@Cellule
Copy link
Contributor Author

Cellule commented Jan 27, 2017

@Krovatkin @commonlisp @arunetm You guys might be interested in this

{
if (newBufferLength == this->bufferLength)
{
return this;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@MikeHolman I don't fully understand the spec for TransferInternal.
Must I always return a new ArrayBuffer or returning the current one is valid if the buffer doesn't change ?

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, it should always return a new ArrayBuffer

@Krovatkin
Copy link
Collaborator

Krovatkin commented Jan 27, 2017

@Cellule we are very much so! Thank you very much for a heads-up. We have high hopes that this change will improve some benchmark numbers 🎆

@Cellule
Copy link
Contributor Author

Cellule commented Feb 14, 2017

ping

Create WebAssemblyArrayBuffer that forces to use VirtualAlloc on x64 Windows
Change the type of config flag for WasmFastArray
{
return false;
if (isAsmJs)
Copy link
Contributor

Choose a reason for hiding this comment

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

i think we should make it more clear that this also will include wasm, e.g. by renaming this var

}
else if (isWasm)
{
JavascriptError::ThrowWebAssemblyRuntimeError(func->GetScriptContext(), JSERR_InvalidTypedArrayIndex);
Copy link
Contributor

Choose a reason for hiding this comment

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

gotta say, i'm kind of amazed that this "just works"

@MikeHolman
Copy link
Contributor

:shipit:

@chakrabot chakrabot merged commit 2982cfa into chakra-core:master Feb 17, 2017
chakrabot pushed a commit that referenced this pull request Feb 17, 2017
Merge pull request #2423 from Cellule:wasm/fastarray

Closes #1888
Related #2100

This PR implements the fast array (aka 8GB array) for WebAssembly on Windows x64.
I have put the feature under a flag (turned on by default) to help with testing and possibly debugging future issues.
This creates a new type of ArrayBuffer, `WebAssemblyArrayBuffer ` which, since the creation is controlled within WebAssembly, always allocate the buffer in virtual memory regardless of size or asm.js constraint.
@Cellule Cellule deleted the wasm/fastarray branch February 17, 2017 02:33
@Cellule Cellule moved this from Pull Requests to Completed in WebAssembly Mar 1, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
WebAssembly
Completed
Development

Successfully merging this pull request may close these issues.

None yet

5 participants