Commit facdbe2
committed
Make BigDecimal object embedded
Fix: #293
BigDecimal is a very good fit for embedded objects, as most of
them are small, and they're all immutable, so they don't need
any resizing.
In most case it results in smaller objects, but also reduces pointer
chasing as well as make these objects faster to free for the GC.
master:
```ruby
>> ObjectSpace.memsize_of(BigDecimal("422343434234234234234234234234423"))
=> 92
>> ObjectSpace.memsize_of(BigDecimal("4223434342342342342342342342344232342423423"))
=> 96
```
This branch:
```ruby
>> ObjectSpace.memsize_of(BigDecimal("422343434234234234234234234234423"))
=> 80
>> ObjectSpace.memsize_of(BigDecimal("4223434342342342342342342342344232342423423"))
=> 160
```1 parent e64c502 commit facdbe2
4 files changed
Lines changed: 110 additions & 180 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
5 | | - | |
| 5 | + | |
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
9 | | - | |
10 | 9 | | |
11 | | - | |
| 10 | + | |
12 | 11 | | |
13 | 12 | | |
14 | 13 | | |
| |||
0 commit comments