anchor.diff:              List.forall isPure (Children expr)
           | _ -> false
   
  -    let size = Seq.length (All expr)
  -
       // counts free occurences of var in expr
  +    // return : 0 - no occurences; 1 - one occurence; 2 - unknown
       // assumes IsAlphaNormalized on all expressions invovled
       // because of the invariant, all occurences are free
  -    let occurenceCount (var: Id) expr =
  +    let occurenceCountApprox (var: Id) (expr: E) =
           if var.Mutable then
               invalidArg "var" "Var should not be mutable"
  -        let mutable count = 0
  -        for e in All expr do
  -            match e with
  -            | Var v when v = var -> count <- count + 1
  -            | _ -> ()
  -        count
  +        let all = All expr
  +        use e = all.GetEnumerator()
  +        let rec loop (steps: int) (occurs: int) =
  +            if steps > 64 then 2 else
  +                if e.MoveNext() then
  +                    match e.Current with
  +                    | Var v when v = var ->
  +                        match occurs + 1 with
  +                        | 1 -> loop (steps + 1) 1
  +                        | _ -> 2
  +                    | _ ->
  +                        loop (steps + 1) occurs
  +                else occurs
  +        loop 0 0
   
       // optimizes a given expr = Let (var, value, body)
       // assuming occurenceCount var body = 1
  
positive.code:     let step expr =
          match expr with
          | Application (Lambda (None, args, body), xs) ->
              let rec binds args xs body =
                  match args, xs with
                  | a :: args, x :: xs -> Let (a, x, binds args xs body)
                  | [], [] -> body
                  | [], _ -> Application(body, xs)
                  | _, [] -> Lambda(None, args, body)
              binds args xs body
          | Application (Let (var, value, body), xs) ->
              Let (var, value, Application (body, xs))
          | Lambda (None, [x], Application (f, [Var y])) ->
              if x = y && isPure f then f else expr
          | Let (var, Let (v, vl, bd), body) ->
              Let (v, vl, Let (var, bd, body))
          | Let (var, value, Application (f, [Var v])) when v = var && isPure f ->
              Application(f, [value])
          | Let (var, value, body) when not var.IsMutable ->
              match value with
              | Constant _ | Global _ | Runtime ->
  
negative.code:         | FieldSet (Var objVar, Constant (String field), value) ->
              Some (objVar, (field, value))
          | Let (var, value, PropSet ((objVar, (field, Var v)))) when v = var ->
              Some (objVar, (field, value))
          | _ -> None
      let rec coll expr =
          match expr with
          | Let (objVar, NewObject objFields, Sequential (propSetters, Var v)) when v = objVar ->
  