Math.sincos(x)?
Nicolas B. Pierron
nicolas.b.pierron at mozilla.com
Fri Jun 23 16:03:50 UTC 2017
On Fri, Jun 23, 2017 at 10:38 AM, Robert Poor <rdpoor at gmail.com> wrote:
>> `return { sin: sin(theta), cos: cos(theta) };` will add pressure to the
>> nursery of the garbage collector.
>
> True -- forgive my ignorance, but is there a way to return multiple values
> that does not cause heap allocation? That was my intention.
The only one I know, is by setting the properties of an object given
as arguments, assuming that the property do exists, and that the
object is reused for multiple calls.
> Another possible optimization: cache theta with its interval-reduced
> equivalent. If you get a subsequent call with the same theta, you've
> already done half the work.
As far as I know the spec does not provide any mean to specify an
acceptable precision to math operations so having an interval-reduced
equivalent would not be compliant with the spec.
--
Nicolas B. Pierron
More information about the es-discuss
mailing list