Opened 9 years ago

Last modified 9 years ago

#15950 new enhancement

Consider using a faster malloc()

Reported by: Marc Mezzarobba Owned by:
Priority: major Milestone: sage-wishlist
Component: performance Keywords:
Cc: Paul Zimmermann Merged in:
Authors: Reviewers:
Report Upstream: N/A Work issues:
Branch: Commit:
Dependencies: Stopgaps:

Status badges

Description (last modified by Marc Mezzarobba)

Some unscientific experiments suggesting that sage may benefit from using a custom malloc(), at least on Linux/glibc:

$ sage
┌────────────────────────────────────────────────────────────────────┐
│ Sage Version 6.2.beta4, Release Date: 2014-03-11                   │
│ Type "notebook()" for the browser-based notebook interface.        │
│ Type "help()" for help.                                            │
└────────────────────────────────────────────────────────────────────┘
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
┃ Warning: this is a prerelease version, and it may be unstable.     ┃
┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
sage: P.<a,b,c> = PolynomialRing(QQ)
sage: %timeit d=(a+b+c+1)^100
1 loops, best of 3: 5.42 s per loop
sage: m = random_matrix(QQ, 1000)
sage: %timeit m**2
1 loops, best of 3: 957 ms per loop
$ LD_PRELOAD="libjemalloc.so.1" sage
┌────────────────────────────────────────────────────────────────────┐
│ Sage Version 6.2.beta4, Release Date: 2014-03-11                   │
│ Type "notebook()" for the browser-based notebook interface.        │
│ Type "help()" for help.                                            │
└────────────────────────────────────────────────────────────────────┘
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
┃ Warning: this is a prerelease version, and it may be unstable.     ┃
┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
sage: P.<a,b,c> = PolynomialRing(QQ)
sage: %timeit d=(a+b+c+1)^100
1 loops, best of 3: 3.98 s per loop
sage: m = random_matrix(QQ, 1000)
sage: %timeit m**2
1 loops, best of 3: 1.07 s per loop
$ LD_PRELOAD="/usr/lib/libtcmalloc.so.4" sage
┌────────────────────────────────────────────────────────────────────┐
│ Sage Version 6.2.beta4, Release Date: 2014-03-11                   │
│ Type "notebook()" for the browser-based notebook interface.        │
│ Type "help()" for help.                                            │
└────────────────────────────────────────────────────────────────────┘
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
┃ Warning: this is a prerelease version, and it may be unstable.     ┃
┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
sage: P.<a,b,c> = PolynomialRing(QQ)
sage: %timeit d=(a+b+c+1)^100
1 loops, best of 3: 3.85 s per loop
sage: m = random_matrix(QQ, 1000)
sage: %timeit m**2
1 loops, best of 3: 840 ms per loop

Change History (1)

comment:1 Changed 9 years ago by Marc Mezzarobba

Description: modified (diff)
Note: See TracTickets for help on using tickets.