question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

optimize numeric operators in JS

See original GitHub issue

A part of #5812 that wasn’t explicitly stated in the issue description, but that @chochos and I had talked about, was optimization of the numeric operators +, -, *, /. Currently they still compile down to the relatively expensive method calls plus(), times(), etc.

Note that we can probably only do this when the static type of both operands is exactly Integer or Float. (Not sure about Byte.)

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:21 (21 by maintainers)

github_iconTop GitHub Comments

1reaction
gavinkingcommented, Apr 21, 2018

This is now done, native operators are used wherever reasonable, and there is no boxing of Floats within operator expressions. Finally!

0reactions
gavinkingcommented, Apr 21, 2018

I’ve spent most of today working on this issue, and the situation is now much better.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Optimizing javascript code to use integer arithmetic
You can use Int8, Uint8, Int16, etc. in javascript, but it requires a bit more effort than normal - see TypedArrays.
Read more >
Javascript tips and tricks to Optimize Performance
Javascript tips and tricks to Optimize Performance · 1. Use Array Filter · 2. Using String replace function to replace all the values...
Read more >
JavaScript Arithmetic - W3Schools
JavaScript Arithmetic Operators. Arithmetic operators perform arithmetic on numbers (literals or variables). Operator, Description. +, Addition.
Read more >
Javascript Operators (With Examples) - TutorialsTeacher
Arithmetic operators are used to perform mathematical operations between numeric operands. Operator, Description. +, Adds two numeric operands. -, Subtract ...
Read more >
1. Code Reuse and Optimization - Supercharged JavaScript ...
 Code Reuse and Optimization JavaScript has an undeservedly dubious reputation ... Bitwise operators convert numbers into 32-bit integers, with a numerical ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found