   innerRebridge(test, N, 300)
 }
 
+fileprivate func innerMutableRebridge(_ str: String, _ N: Int, _ scale: Int = 5000) {
+  for _ in 1...N * scale {
+    let copy = (str as NSString).mutableCopy() as! NSMutableString
+    let bridged = identity(copy) as String
+    blackHole(bridged)
+    blackHole(bridged as NSString)
+  }
+}
+
+public func run_NSStringConversion_rebridgeMutable(_ N: Int) {
+  innerMutableRebridge(mutableTest, N, 1000)
+}
+
+public func run_NSStringConversion_nonASCII_rebridgeMutable(_ N: Int) {
+  innerMutableRebridge(mutableTest, N, 500)
+}
+
+public func run_NSStringConversion_medium_rebridgeMutable(_ N: Int) {
+  innerMutableRebridge(mutableTest, N, 500)
+}
+
+public func run_NSStringConversion_long_rebridgeMutable(_ N: Int) {
+  innerMutableRebridge(mutableTest, N, 500)
+}
+
+public func run_NSStringConversion_longNonASCII_rebridgeMutable(_ N: Int) {
+  innerMutableRebridge(mutableTest, N, 300)
+}
+
 #endif

import Foundation

fileprivate var test:NSString = ""

public let NSStringConversion = [
  BenchmarkInfo(name: "NSStringConversion",

  innerLoop(test, N, 300)
}

fileprivate func innerMutableLoop(_ str: String, _ N: Int, _ scale: Int = 5000) {
  for _ in 1...N * scale {
    let copy = (str as NSString).mutableCopy() as! NSMutableString
    for char in (identity(copy) as String).utf8 {
      blackHole(char)
    }
  }
}

public func run_NSStringConversion_nonASCIIMutable(_ N: Int) {
  innerMutableLoop(mutableTest, N, 500)
}

public func run_NSStringConversion_mediumMutable(_ N: Int) {
  innerMutableLoop(mutableTest, N, 500)
}

public func run_NSStringConversion_longMutable(_ N: Int) {
  innerMutableLoop(mutableTest, N, 250)
}

public func run_NSStringConversion_longNonASCIIMutable(_ N: Int) {
  innerMutableLoop(mutableTest, N, 150)
}

fileprivate func innerRebridge(_ str: NSString, _ N: Int, _ scale: Int = 5000) {
  for _ in 1...N * scale {
    let bridged = identity(str) as String
