I would try to make some performance test but if i have to guess then
i think the current jvms will optimize it away for you and you wont
notice a big performance drop.
Maybe help hotspot a bit by using the final keyword on methods and
classes as much as possible

On 22/10/2009, Matthieu Riou <[email protected]> wrote:
> Hi,
>
> I've started working on the support of native exact Decimal numbers in
> Rhino, following the proposition that was formulated by Sam Ruby (with
> some feedback from Brendand Eich as I understand it):
>
> http://intertwingly.net/blog/2008/07/11/Decimal-in-ECMAScript
> https://bugzilla.mozilla.org/show_bug.cgi?id=445178
>
> I'm mostly done with the implementation in the interpreter, I still
> need to beef up a bit the test cases to cover more corner cases but
> overall it seems to work fine. The compiler is another beast (isn't it
> always?) and I'm confronted with a hard choice so I thought I would
> ask for some feedback from people in the know.
>
> In the Codegen, the code path for addition goes most often to
> ScriptRuntime as the addition operation in Javascript has to deal with
> numbers and objects. Subtraction, multiplication and a few others
> don't have this problem so they're implemented as a direct operation
> on doubles done directly on the stack, which I would assume is
> sensibly faster. Adding decimal support though would spoil the broth a
> bit.
>
> I haven't found a way to have a compiled bytecode for those operations
> that would deal with doubles directly on the stack and decimals using
> a ScriptRuntime-style invocation. This ends up mixing doubles and
> words and shortcutting operations which leads to inconsistent stack
> states. Which mean that, to implement Decimal, I would have to slow
> down a bit *, -, / and %. Note that the performance would still be on
> par with addition.
>
> So how does that sound? Do you feel like the performance cost is
> marginal enough that it won't really matter? Or do you see other
> implementation solutions?
>
> Thanks for reading!
> Matthieu
> _______________________________________________
> dev-tech-js-engine-rhino mailing list
> [email protected]
> https://lists.mozilla.org/listinfo/dev-tech-js-engine-rhino
>
_______________________________________________
dev-tech-js-engine-rhino mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-tech-js-engine-rhino

Reply via email to