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

Fix JavaScript randmatstat matrix calculations #24385

Merged
merged 1 commit into from
Oct 29, 2017

Conversation

Enet4
Copy link
Contributor

@Enet4 Enet4 commented Oct 28, 2017

It seems that the calculations in the JavaScript micro benchmark analogous to the Julia code trace((P.'*P)^4) had some issues:

  • The dot product matrix of P.'*P was incorrectly sized as n x n, instead of the actual 4n x 4x. JavaScript Float64Arrays do not throw an error when reading or writing outside of its boundaries, which probably contributed to the confusion.
  • Rather than raising the matrix by the power of 4, the same square of the matrices PMatMul and QMatMul were being calculated twice. I took the trick from the C benchmark and calculated a second power of two after the first, while reusing matrices where possible.

This seems to make the function more than 3 times slower, but it favours fairness towards the other benchmarks. In the future, one might consider making a version of the same program that compiles to WebAssembly in asm.js.

@ViralBShah
Copy link
Member

cc @johnfgibson to take a look.

@johnfgibson
Copy link
Contributor

Unfortunately I've got a really tough week coming up and will probably not be able to look at this carefully until next weekend. But I will then. Thanks for the fix, @Enet4.

@ViralBShah
Copy link
Member

I got a chance to dive into this, and looks good.

@ViralBShah ViralBShah merged commit 268f878 into JuliaLang:master Oct 29, 2017
@Enet4 Enet4 deleted the fix/js-micro-randmatstat branch October 29, 2017 15:08
ararslan pushed a commit that referenced this pull request Nov 10, 2017
ararslan pushed a commit that referenced this pull request Nov 14, 2017
ararslan pushed a commit that referenced this pull request Nov 21, 2017
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.

4 participants