Opened 2 years ago

Closed 2 years ago

#26775 closed enhancement (invalid)

Speed up actions in coercion model

Reported by: jdemeyer Owned by:
Priority: major Milestone: sage-duplicate/invalid/wontfix
Component: coercion Keywords:
Cc: tscrim Merged in:
Authors: Jeroen Demeyer Reviewers:
Report Upstream: N/A Work issues:
Branch: Commit:
Dependencies: #24500 Stopgaps:

Status badges

Description (last modified by jdemeyer)

This is the logic that the coercion model uses when it calls an action:

  1. Get the action object (an Action instance) given the parents of both arguments and the operation. This is cached using TripleDict, so lookup of known actions is fast.
  1. Call the action using the generic __call__ interface.
  1. The action checks again the parents of the arguments.
  1. The actual action method _act_ is called.

Step 3 takes a non-trivial amount of time and is completely unneeded since the coercion model already knows that the parents are correct.

We also remove the (op is not sub) and (op is not isub) checks: I see no reason why actions should not be allowed for subtraction.

Change History (2)

comment:1 Changed 2 years ago by jdemeyer

  • Description modified (diff)

comment:2 Changed 2 years ago by jdemeyer

  • Milestone changed from sage-8.5 to sage-duplicate/invalid/wontfix
  • Resolution set to invalid
  • Status changed from new to closed

Never mind, the description is wrong.

Note: See TracTickets for help on using tickets.