Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
03/11/17 20:07:13 (7 years ago)
Author:
pkimmesw
Message:

#2665 PooledPushProgram reduces memory usage and increases performance

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/PushGP/HeuristicLab.PushGP/HeuristicLab.Problems.ProgramSynthesis/Push/Interpreter/PushInterpreter.cs

    r14745 r14746  
    22  using System;
    33  using System.Collections.Generic;
     4#if DEBUG
     5  using System.Linq;
     6#endif
    47  using System.Runtime.CompilerServices;
    58  using System.Threading;
     
    710  using HeuristicLab.Core;
    811  using HeuristicLab.Problems.ProgramSynthesis.Push.Configuration;
     12  using HeuristicLab.Problems.ProgramSynthesis.Push.Data.Pool;
    913  using HeuristicLab.Problems.ProgramSynthesis.Push.Expressions;
    1014  using HeuristicLab.Problems.ProgramSynthesis.Push.Parser;
     
    8286    }
    8387
     88    public IManagedPool<PushProgram> PushProgramPool { get; set; }
     89
    8490    public IReadonlyPushConfiguration Configuration { get; protected set; }
    8591
     
    249255    }
    250256
     257#if DEBUG
     258    private Expression last;
     259    private bool DoStep() {
     260      var expression = ExecStack.Pop();
     261
     262      if (ExecStack.Any(e => e == null)) {
     263        throw new InvalidProgramException();
     264      }
     265
     266      var succ = expression.Eval(this);
     267      last = expression;
     268
     269      return succ;
     270    }
     271#else
    251272    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    252273    private bool DoStep() {
    253274      return ExecStack.Pop().Eval(this);
    254275    }
     276#endif
    255277
    256278    private Task InterpretAsync() {
Note: See TracChangeset for help on using the changeset viewer.