private function optimizer()
  {
    $optimizeOption = -1;

    if ($this->environment['cache'] === false) {
      $optimizeOption = 2;
    }

    switch ($optimizeOption) {
      case -1:
        $nodeVisitorOptimizer = Twig_NodeVisitor_Optimizer::OPTIMIZE_ALL;
        break;

      case 0:
        $nodeVisitorOptimizer = Twig_NodeVisitor_Optimizer::OPTIMIZE_NONE;
        break;

      case 2:
        $nodeVisitorOptimizer = Twig_NodeVisitor_Optimizer::OPTIMIZE_FOR;
        break;

      case 4:
        $nodeVisitorOptimizer = Twig_NodeVisitor_Optimizer::OPTIMIZE_RAW_FILTER;
        break;

      case 8:
        $nodeVisitorOptimizer = Twig_NodeVisitor_Optimizer::OPTIMIZE_VAR_ACCESS;
        break;

      default:
        $nodeVisitorOptimizer = Twig_NodeVisitor_Optimizer::OPTIMIZE_ALL;
        break;
    }

    $optimizer = new Twig_Extension_Optimizer($nodeVisitorOptimizer);
    $this->twig->addExtension($optimizer);
  }