Ticket #1071 (closed enhancement: fixed)

Opened 6 years ago

Last modified 4 years ago

[with patch] IntegerVectors_nk

Reported by: malb Owned by: mhansen
Priority: major Milestone: sage-2.8.12
Component: combinatorics Keywords:
Cc: sage-combinat Work issues:
Report Upstream: Reviewers:
Authors: Merged in:
Dependencies: Stopgaps:

Description

calling IntegerVectors?.list after applying the attached patch is much faster now.

old:

sage: time l1 = map(tuple, IntegerVectors(2, 60).list())
CPU time: 5.01 s,  Wall time: 5.11 s

new:

sage: time l1 = map(tuple, IntegerVectors(2, 60).list())
CPU time: 0.20 s,  Wall time: 0.20 s

Attachments

iv.patch Download (3.2 KB) - added by malb 6 years ago.
1071.patch Download (3.4 KB) - added by mhansen 6 years ago.
1071-final.patch Download (5.6 KB) - added by mhansen 6 years ago.
1071-final.2.patch Download (5.0 KB) - added by mhansen 6 years ago.

Change History

Changed 6 years ago by malb

Changed 6 years ago by mhansen

comment:1 Changed 6 years ago by mhansen

Updated patch attached.

comment:2 Changed 6 years ago by mhansen

  • Milestone changed from sage-2.9.1 to sage-2.8.12

comment:3 Changed 6 years ago by malb

Please note that the cleaner version by mhansen is by a factor of three than the original submission:

the untouched implementation
sage: time l1 = map(tuple, IntegerVectors(2, 60).list())
CPU times: user 5.06 s, sys: 0.11 s, total: 5.18 s
Wall time: 5.18

mhansen's implementation

sage: time l1 = map(tuple, IntegerVectors(2, 60, min_part=0).list())
CPU time: 0.56 s,  Wall time: 0.57 s

malb's original submission

sage: time l1 = map(tuple, IntegerVectors(2, 60).list())
CPU time: 0.20 s,  Wall time: 0.20 s

I don't mean to push my original patch (which's problems were fixed by mhansen) but propose to optimise mhansen's patch eventually.

comment:4 Changed 6 years ago by mabshoff

  • Status changed from new to closed
  • Resolution set to fixed

applied mhansen's patch to 2.8.12.rc0

Changed 6 years ago by mhansen

Changed 6 years ago by mhansen

comment:5 Changed 4 years ago by nthiery

  • Cc sage-combinat added
Note: See TracTickets for help on using tickets.