anchor.diff:      member this.System = system
   
       member this.Iterate (fn : Statement<'c, 's>) state =
  -        let mutable world = state
  -        let array = system.Correlateds.Array
  -        for i in 0 .. array.Length - 1 do
  -            world <- fn.Invoke (&array.[i], world)
  -        world
  +        if Seq.isEmpty excluding then
  +            let array = system.Correlateds.Array
  +            let mutable state = state
  +            for i in 0 .. array.Length - 1 do
  +                state <- fn.Invoke (&array.[i], state)
  +            state
  +        else
  +            let array = system.Correlateds.Array
  +            let mutable state = state
  +            let mutable enr = cache.ValuesEnumerator
  +            while enr.MoveNext () do
  +                state <- fn.Invoke (&array.[enr.Current], state)
  +            state
   
       member this.IterateBuffered (fn : Statement<'c, 'w>) world =
  -        system.WithCorrelatedsBuffered (fun aref world ->
  -            let mutable world = world
  -            let array = aref.Array
  -            for i in 0 .. array.Length - 1 do
  -                world <- fn.Invoke (&array.[i], world)
  -            world)
  -            world
  +        if Seq.isEmpty excluding then
  +            system.WithCorrelatedsBuffered (fun aref world ->
  +                let array = aref.Array
  +                let mutable world = world
  +                for i in 0 .. array.Length - 1 do
  +                    world <- fn.Invoke (&array.[i], world)
  +                world)
  +                world
  +        else
  +            system.WithCorrelatedsBuffered (fun aref world ->
  +                let array = aref.Array
  +                let mutable world = world
  +                let mutable enr = cache.ValuesEnumerator
  +                while enr.MoveNext () do
  +                    let index = enr.Current
  +                    world <- fn.Invoke (&array.[index], world)
  +                world)
  +                world
   
       member this.Index (entityId : uint64) (fn : Statement<'c, 's>) state =
  -        let cref = system.IndexCorrelated entityId
  -        fn.Invoke (&cref.Index, state)
  +        if Seq.isEmpty excluding then
  +            let cref = system.IndexCorrelated entityId
  +            fn.Invoke (&cref.Index, state)
  +        else
  +            let array = system.Correlateds.Array
  +            let index = cache.[entityId]
  +            fn.Invoke (&array.[index], state)
   
       member this.IndexBuffered (entityId : uint64) (fn : Statement<'c, 'w>) world =
  -        system.WithCorrelatedsBuffered (fun array state ->
  -            let index = system.IndexCorrelatedToI entityId
  -            fn.Invoke (&array.[index], state))
  -            world
  +        if Seq.isEmpty excluding then
  +            system.WithCorrelatedsBuffered (fun array world ->
  +                let index = system.IndexCorrelatedToI entityId
  +                fn.Invoke (&array.[index], world))
  +                world
  +        else
  +            system.WithCorrelatedsBuffered (fun array world ->
  +                let index = cache.[entityId]
  +                fn.Invoke (&array.[index], world))
  +                world
   
       member this.RegisterCorrelated ordered comp entityId world =
           ecs.RegisterCorrelated<'c> ordered comp entityId world
  
positive.code:         else struct (false, world)
  
      interface Query<'w> with
          override this.Correlation = correlation
          override this.Filter _ = ()
  
  /// An ECS query.
  type Query<'c, 'c2, 'w when
      'c : struct and 'c :> 'c Component and
      'c2 : struct and 'c2 :> 'c2 Component> (ecs : 'w Ecs) =
  
      let cache = OrderedDictionary<uint64, struct (int * int)> HashIdentity.Structural
      let correlation = hashSetPlus<string> StringComparer.Ordinal [typeof<'c>.Name; typeof<'c2>.Name]
      let system = ecs.IndexSystem<'c, SystemCorrelated<'c, 'w>> ()
      let system2 = ecs.IndexSystem<'c2, SystemCorrelated<'c2, 'w>> ()
  
negative.code:             let indexOpt2 = system2.TryIndexCorrelatedToI entityId
              let indexOpt3 = system3.TryIndexCorrelatedToI entityId
              let indexOpt4 = system4.TryIndexCorrelatedToI entityId
              if indexOpt > -1 && indexOpt2 > -1 && indexOpt3 > -1 && indexOpt4 > -1 then
                  let systemIds = ecs.IndexSystemIds entityId
                  if not (systemIds.IsSupersetOf excluding)
                  then cache.[entityId] <- struct (indexOpt, indexOpt2, indexOpt3, indexOpt4)
                  else cache.Remove entityId |> ignore<bool>
              elif indexOpt > -1 || indexOpt2 > -1 || indexOpt3 > -1 || indexOpt4 > -1 then // OPTIMIZATION: make sure it exists and needs removing
                  cache.Remove entityId |> ignore<bool>
  
  