Opened 12 years ago

Closed 12 years ago

#5652 closed defect (duplicate)

powermod is slower than Integer.power_mod

Reported by: bober Owned by: somebody
Priority: minor Milestone: sage-duplicate/invalid/wontfix
Component: basic arithmetic Keywords:
Cc: mvngu, was Merged in:
Authors: Reviewers:
Report Upstream: Work issues:
Branch: Commit:
Dependencies: Stopgaps:

Status badges

Description

Consider the following example:

sage: time a = power_mod(5, 10^2000, 10^3000)
CPU times: user 3.67 s, sys: 0.00 s, total: 3.67 s
Wall time: 3.67 s
sage: time b = 5.powermod(10^2000, 10^3000)  
CPU times: user 2.82 s, sys: 0.00 s, total: 2.83 s
Wall time: 2.84 s
sage: a == b
True
sage: time a = power_mod(5, 10^4000, 10^7000)
CPU times: user 27.17 s, sys: 0.01 s, total: 27.18 s
Wall time: 27.30 s
sage: time b = 5.powermod(10^4000, 10^7000)  
CPU times: user 21.38 s, sys: 0.04 s, total: 21.42 s
Wall time: 21.44 s
sage: a == b
True

(The problem is that power_mod() uses generic code, while Integer.powermod() uses gmp, which is faster.)

Change History (3)

comment:1 follow-up: Changed 12 years ago by burcin

  • Cc mvngu was added
  • Summary changed from powermod is slower than Integer.power_mod to [duplicate] powermod is slower than Integer.power_mod

This is a duplicate of #5082.

I suggest it is closed as a duplicate. Since trac doesn't let me, Minh or William, as release managers, can you close this?

comment:2 in reply to: ↑ 1 Changed 12 years ago by mvngu

Replying to burcin:

This is a duplicate of #5082.

I suggest it is closed as a duplicate. Since trac doesn't let me, Minh or William, as release managers, can you close this?

I don't have admin privileges on trac, so I can't close tickets at the moment. I've merged about 5 tickets so far, but their status has not been set accordingly.

comment:3 Changed 12 years ago by mvngu

  • Milestone changed from sage-4.1.1 to sage-duplicate/invalid/wontfix
  • Resolution set to duplicate
  • Status changed from new to closed
  • Summary changed from [duplicate] powermod is slower than Integer.power_mod to powermod is slower than Integer.power_mod
Note: See TracTickets for help on using tickets.