Free cookie consent management tool by TermsFeed Policy Generator

Opened 13 years ago

Closed 12 years ago

#1774 closed task (done)

Getting instances of generic types through the ApplicationManager is slow when the debugger is attached

Reported by: abeham Owned by: abeham
Priority: medium Milestone: HeuristicLab 3.3.7
Component: PluginInfrastructure Version: 3.3.7
Keywords: Cc:

Description (last modified by abeham)

On my machine with the VS debugger attached, it takes roughly two minutes for the call to e.g. ApplicationManager.Manager.GetInstances<HeuristicOptimizationProblem<IEvaluator, ISolutionCreator>>() to complete (it should be equally slow for any generic type).

The performance issue seems to be in LightweightApplicationManager.CheckTypeCompatibility(Type type, Type other) as well as in the SandboxApplicationManager:

if (type.IsGenericType && other.IsGenericType) {
  try {
    if (type.IsAssignableFrom(other.GetGenericTypeDefinition().MakeGenericType(type.GetGenericArguments())))
      return true;
  } catch (Exception) { }
}

Without debugger attached there is no noticeable performance penalty. What is the reason for this rather steep drop in performance?

Attachments (1)

type discovery.patch (8.3 KB) - added by mkommend 13 years ago.
contains unit test and temporary implementation for reviewing purpose

Download all attachments as: .zip

Change History (9)

comment:1 Changed 13 years ago by abeham

  • Description modified (diff)
  • Owner changed from gkronber to mkommend
  • Status changed from new to assigned

comment:2 Changed 13 years ago by mkommend

  • Status changed from assigned to accepted

comment:3 Changed 13 years ago by mkommend

  • Milestone changed from HeuristicLab 3.3.x Backlog to HeuristicLab 3.3.7
  • Priority changed from low to medium

comment:4 Changed 13 years ago by mkommend

r7492: Improved performance of type discovery for generic types.

Changed 13 years ago by mkommend

contains unit test and temporary implementation for reviewing purpose

comment:5 Changed 13 years ago by mkommend

  • Owner changed from mkommend to abeham
  • Status changed from accepted to reviewing

gkronber already had a brief look over the implemented changes

comment:6 Changed 13 years ago by abeham

r7520

  • improved performance of type discovery by moving compatibility check further up the chain (deep cloneable unit test time reduced from 32s to 18s)

comment:7 Changed 12 years ago by abeham

  • Status changed from reviewing to readytorelease

Thx. I don't think we need the unit test in this case.

comment:8 Changed 12 years ago by gkronber

  • Resolution set to done
  • Status changed from readytorelease to closed
  • Version changed from 3.3.6 to 3.3.7
Note: See TracTickets for help on using tickets.