         case unknownType(GAPDataType)
     }
     
-    public init() { }
+    // MARK: - Initialization
+    
+    /// Initialize with default data types.
+    public init() {
+        
+        /// initialize with default precomputed values
+        self.types = GAPDataDecoder.defaultTypes
+        self.dataTypes = GAPDataDecoder.defaultDataTypes
+    }
+    
+    // MARK: - Properties
     
     public var ignoreUnknownType: Bool = false
     
-    public var types: [GAPData.Type] = gapDataTypes
+    public var types = [GAPData.Type]() {
+        didSet {
+            dataTypes = [GAPDataType: GAPData.Type](minimumCapacity: types.count)
+            types.forEach { dataTypes[$0.dataType] = $0 }
+        }
+    }
+    
+    internal private(set) var dataTypes: [GAPDataType: GAPData.Type] = [:]
+    
+    // MARK: - Methods
     
     public func decode(_ data: LowEnergyAdvertisingData) throws -> [GAPData] {
         

        return try decoder.decode(data)
    }
}

internal let gapDataTypes: [GAPData.Type] = [
    GAP3DInformation.self,
    GAPAdvertisingInterval.self,
    GAPAppearanceData.self,
    GAPChannelMapUpdateIndication.self,
    GAPClassOfDevice.self,
    GAPCompleteListOf16BitServiceClassUUIDs.self,
    GAPCompleteListOf32BitServiceClassUUIDs.self,
    GAPCompleteListOf128BitServiceClassUUIDs.self,
    GAPCompleteLocalName.self,
    GAPFlags.self,
    GAPIncompleteListOf16BitServiceClassUUIDs.self,
    GAPIncompleteListOf32BitServiceClassUUIDs.self,
    GAPIncompleteListOf128BitServiceClassUUIDs.self,
    GAPIndoorPositioning.self,
    GAPLEDeviceAddress.self,
    GAPLERole.self,
    GAPLESecureConnectionsConfirmation.self,
    GAPLESecureConnectionsRandom.self,
    //GAPLESupportedFeatures.self,
    GAPListOf16BitServiceSolicitationUUIDs.self,
    GAPListOf32BitServiceSolicitationUUIDs.self,
    GAPListOf128BitServiceSolicitationUUIDs.self,
    GAPManufacturerSpecificData.self,
    GAPMeshBeacon.self,
    GAPMeshMessage.self,
    GAPPBADV.self,
    GAPPublicTargetAddress.self,
    GAPRandomTargetAddress.self,
    GAPSecurityManagerOOBFlags.self,
    GAPSecurityManagerTKValue.self,
    GAPServiceData16BitUUID.self,
    GAPServiceData32BitUUID.self,
    GAPServiceData128BitUUID.self,
    GAPShortLocalName.self,
    GAPSimplePairingHashC.self,
    GAPSimplePairingRandomizerR.self,
    GAPSlaveConnectionIntervalRange.self,
    GAPTransportDiscoveryData.self,
    GAPTxPowerLevel.self,
    GAPURI.self
]

        
        return elements
    }
}

internal extension GAPDataDecoder {
    
    internal static let defaultDataTypes: [GAPDataType: GAPData.Type] = {
        //let types = [GAPDataType: GAPData.Type].init(grouping: defaultTypes, by: { $0.dataType })
        var types = [GAPDataType: GAPData.Type](minimumCapacity: defaultTypes.count)
        defaultTypes.forEach { types[$0.dataType] = $0 }
        return types
    }()
    
    internal static let defaultTypes: [GAPData.Type] = [
        GAP3DInformation.self,
        GAPAdvertisingInterval.self,
        GAPAppearanceData.self,
        GAPChannelMapUpdateIndication.self,
        GAPClassOfDevice.self,
        GAPCompleteListOf16BitServiceClassUUIDs.self,
        GAPCompleteListOf32BitServiceClassUUIDs.self,
        GAPCompleteListOf128BitServiceClassUUIDs.self,
        GAPCompleteLocalName.self,
        GAPFlags.self,
        GAPIncompleteListOf16BitServiceClassUUIDs.self,
        GAPIncompleteListOf32BitServiceClassUUIDs.self,
        GAPIncompleteListOf128BitServiceClassUUIDs.self,
        GAPIndoorPositioning.self,
        GAPLEDeviceAddress.self,
        GAPLERole.self,
        GAPLESecureConnectionsConfirmation.self,
        GAPLESecureConnectionsRandom.self,
        //GAPLESupportedFeatures.self,
        GAPListOf16BitServiceSolicitationUUIDs.self,
        GAPListOf32BitServiceSolicitationUUIDs.self,
        GAPListOf128BitServiceSolicitationUUIDs.self,
        GAPManufacturerSpecificData.self,
        GAPMeshBeacon.self,
        GAPMeshMessage.self,
        GAPPBADV.self,
        GAPPublicTargetAddress.self,
        GAPRandomTargetAddress.self,
        GAPSecurityManagerOOBFlags.self,
        GAPSecurityManagerTKValue.self,
        GAPServiceData16BitUUID.self,
        GAPServiceData32BitUUID.self,
        GAPServiceData128BitUUID.self,
        GAPShortLocalName.self,
        GAPSimplePairingHashC.self,
        GAPSimplePairingRandomizerR.self,
        GAPSlaveConnectionIntervalRange.self,
        GAPTransportDiscoveryData.self,
        GAPTxPowerLevel.self,
        GAPURI.self
    ]
}

// MARK: - Deprecated
