-
Notifications
You must be signed in to change notification settings - Fork 35
Operation result being copy/noncopy is inconsistent for some operations #48
Copy link
Copy link
Open
Labels
is this optimal?possible performance improvementspossible performance improvements
Description
I haven't checked other operations, but in some cases add can return the same instance that was passed as left-hand side Decimal.
https://github.com/Patashu/break_infinity.js/blob/master/src/break_infinity.ts#L869
We need to decide if we want Decimal to be
- Faster, with less allocations
- Slower, but without pitfalls
I believe that returning the same instance can lead to some quirky bugs caused by innate mutability of Decimal, but it's your call.
Keep in mind that "faster" and "slower" doesn't really mean object allocation itself (which a really lightweight operation), but instead the fact that it will add to garbage and GC will be invoked sooner.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
is this optimal?possible performance improvementspossible performance improvements