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

100x slower performance for numeric operations via method ['$+'] vs native operation. #534

Closed
ohjames opened this Issue Apr 21, 2014 · 6 comments

Comments

3 participants
@ohjames
Copy link

ohjames commented Apr 21, 2014

Check this jsperf which compares native JS numeric operation for addition :

http://jsperf.com/sm0t0

There's no way to get around this I think without providing optional type annotations to opal... something like:

def add(a : Number, b : Number)
  a + b
end

And the compiler would know to use native operations for variables that have given Number (or other compatible) types. I guess like the crystal compiler.

@vendethiel

This comment has been minimized.

Copy link
Contributor

vendethiel commented Apr 21, 2014

See #520

@elia

This comment has been minimized.

Copy link
Member

elia commented Apr 21, 2014

I think it's just better to stick to the two languages we kinda know and use JS via backticks for performance critical code

@elia elia closed this Apr 21, 2014

@ohjames

This comment has been minimized.

Copy link

ohjames commented Apr 21, 2014

Fair enough, can't really accept the loss of performance for our use case and don't feel the backtick workaround is good for us; maybe we'll look into using crystal instead.

@elia

This comment has been minimized.

Copy link
Member

elia commented Apr 21, 2014

Can you add any details about your use case? Maybe there are other solutions.

@elia

This comment has been minimized.

Copy link
Member

elia commented Apr 21, 2014

@nuisanceofcats this Crystal?
(not sure since I don't find any ref to JS on the site…)

@vendethiel

This comment has been minimized.

Copy link
Contributor

vendethiel commented Apr 21, 2014

Yeah, that's not the same use-case

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment