Opened 3 years ago

Closed 3 years ago

#12129 closed task (fixed)

Optimize the implementation of minusInteger in the integer-gmp package

Reported by: admock Owned by: admock
Priority: normal Milestone: 8.2.1
Component: libraries (other) Version: 8.0.1
Keywords: integer-gmp Cc:
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: Runtime performance bug Test Case:
Blocked By: Blocking:
Related Tickets: Differential Rev(s): Phab:D2278
Wiki Page:


As mentioned in, the current implementation of minusInteger is

minusInteger x y = inline plusInteger x (inline negateInteger y)

which always allocates an additional integer. This could be improved by not always calling negateInteger and instead having an implementation more like plusInteger's.

Change History (5)

comment:1 Changed 3 years ago by hvr

Keywords: integer-gmp added
Owner: set to admock

comment:2 Changed 3 years ago by admock

Differential Rev(s): Phab:D2278

comment:3 Changed 3 years ago by Ben Gamari <ben@…>

In 02f893eb/ghc:

integer-gmp: Make minusInteger more efficient

Give `minusInteger` its own implementation.
Previously `minusInteger` used `plusInteger` and `negateInteger`, which
meant it always allocated.  Now it works more like `plusInteger`.

Reviewers: goldfire, hvr, bgamari, austin

Reviewed By: hvr, bgamari, austin

Subscribers: thomie

Differential Revision:

GHC Trac Issues: #12129

comment:4 Changed 3 years ago by bgamari

Milestone: 8.2.1

comment:5 Changed 3 years ago by bgamari

Resolution: fixed
Status: newclosed
Note: See TracTickets for help on using tickets.