Skip to content

Files

Latest commit

 

History

History
23 lines (15 loc) · 570 Bytes

Performance-BigDecimalWithNumericArgument.md

File metadata and controls

23 lines (15 loc) · 570 Bytes

Pattern: Use of BigDecimal with numeric argument

Issue: -

Description

Identifies places where numeric argument to BigDecimal should be converted to string. Initializing from String is faster than from Numeric for BigDecimal.

Examples

# bad
BigDecimal(1, 2)
BigDecimal(1.2, 3, exception: true)

# good
BigDecimal('1', 2)
BigDecimal('1.2', 3, exception: true)

Further Reading