Free cookie consent management tool by TermsFeed Policy Generator

Changeset 2987 for trunk/sources


Ignore:
Timestamp:
03/10/10 03:40:18 (14 years ago)
Author:
swagner
Message:

Cached actual value in parameter lookup to improve performance (#901)

Location:
trunk/sources/HeuristicLab.Parameters/3.3
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Parameters/3.3/LookupParameter.cs

    r2932 r2987  
    4444    }
    4545    public new T ActualValue {
    46       get { return (T)GetActualValue(); }
    47       set { SetActualValue(value); }
     46      get {
     47        if (cachedActualValue == null) cachedActualValue = GetActualValue();
     48        return (T)cachedActualValue;
     49      }
     50      set {
     51        cachedActualValue = value;
     52        SetActualValue(value);
     53      }
    4854    }
    4955
  • trunk/sources/HeuristicLab.Parameters/3.3/Parameter.cs

    r2834 r2987  
    4343      get { return dataType; }
    4444    }
     45    protected IItem cachedActualValue;
    4546    public IItem ActualValue {
    46       get { return GetActualValue(); }
    47       set { SetActualValue(value); }
     47      get {
     48        if (cachedActualValue == null) cachedActualValue = GetActualValue();
     49        return cachedActualValue;
     50      }
     51      set {
     52        cachedActualValue = value;
     53        SetActualValue(value);
     54      }
    4855    }
    4956    [Storable]
     
    5461        if (value != executionContext) {
    5562          executionContext = value;
     63          cachedActualValue = null;
    5664          OnExecutionContextChanged();
    5765        }
Note: See TracChangeset for help on using the changeset viewer.