 }
 
 // Implement it as a tail recursive function.
-private func valueFor(keyPathComponents: [String], dictionary: [String: AnyObject]) -> AnyObject? {
+//
+// `ArraySlice` is used for performance optimization.
+// See https://gist.github.com/norio-nomura/d9ec7212f2cfde3fb662.
+private func valueFor(keyPathComponents: ArraySlice<String>, dictionary: [String: AnyObject]) -> AnyObject? {
     if keyPathComponents.isEmpty {
         return nil
     }

            return nil

        case let dict as [String: AnyObject] where keyPathComponents.count > 1:
            let tail = Array(keyPathComponents[1..<keyPathComponents.count])
            return valueFor(tail, dict)
            
        default:


    private func rawValue(key: String) -> AnyObject? {
        if let dictionary = rawValue as? [String: AnyObject] {
            let components = ArraySlice(split(key) { $0 == "." })
            return valueFor(components, dictionary)
        } else {
            return nil
        }
