Commit 68257e8
Optimize bigfloat memory usage by sharing headers
Bigfloats now share their header (CAR), like other expressions already do via
EQTEST and SIMPIND. New headers are created only when precision changes.
This reduces memory usage and slightly improves bigfloat computation speed.
Bigfloats could already share their CDR (mantissa and exponent) in certain cases.
For example, computing bfloat(1)^0 twice results in bigfloats with the same CDR
object (EQ). Thus, destructive modification of bigfloats was already problematic
before this change, countering concerns that this might introduce risks.
Richard Fateman commented that destructively modifying bigfloat headers is not
something he would have done in the original code, and that he doubts anyone
would have added such code.1 parent f486cbf commit 68257e8
2 files changed
Lines changed: 24 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
268 | 268 | | |
269 | 269 | | |
270 | 270 | | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
271 | 284 | | |
272 | 285 | | |
273 | 286 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
712 | 712 | | |
713 | 713 | | |
714 | 714 | | |
| 715 | + | |
| 716 | + | |
| 717 | + | |
| 718 | + | |
| 719 | + | |
| 720 | + | |
715 | 721 | | |
716 | | - | |
| 722 | + | |
| 723 | + | |
| 724 | + | |
| 725 | + | |
| 726 | + | |
717 | 727 | | |
718 | 728 | | |
719 | 729 | | |
| |||
0 commit comments