Uploaded image for project: 'Swift'
  1. Swift
  2. SR-318

LazyCollection.SubSequence.SubSequence introduces multiple levels of Slice wrapping

    XMLWordPrintable

    Details

      Description

      As Kevin Ballard noticed,

      (swift) LazyCollection<[Int]>.SubSequence.self
      // r0 : LazyCollection<Slice<[Int]>>.Type = Swift.LazyCollection<Swift.Slice<Swift.Array<Swift.Int>>>
      
      (swift) LazyCollection<[Int]>.SubSequence.SubSequence.self
      // r1 : LazyCollection<Slice<Slice<[Int]>>>.Type = Swift.LazyCollection<Swift.Slice<Swift.Slice<Swift.Array<Swift.Int>>>>
      
      (swift) LazyCollection<[Int]>.SubSequence.SubSequence.SubSequence.self
      // r2 : LazyCollection<Slice<Slice<Slice<[Int]>>>>.Type = Swift.LazyCollection<Swift.Slice<Swift.Slice<Swift.Slice<Swift.Array<Swift.Int>>>>>
      

      Multiple levels of Slice<T> wrapping is bad not just because of the type, but because each Slice has its own index bounds stored, and every access through a Slice needs to perform a range check. So having multiple levels of wrapping would affect performance in this case.

        Attachments

          Activity

            People

            Assignee:
            Unassigned
            Reporter:
            gribozavr Dmitri Gribenko
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: