title: Fastest way to save structs iOS / Swift
body: <p>I have structs like</p>
  <pre><code>struct RGBA: Codable {
          
     var r: UInt8
     var g: UInt8
     var b: UInt8
     var a: UInt8 
  }
  </code></pre>
  <p>I want save large amount of this structs (&gt;1_000_000)</p>
  <p>Decode</p>
  <pre><code>guard let history = try? JSONDecoder().decode(HistoryRGBA.self, from: data) else { return }
  </code></pre>
  <p>Encode</p>
  <pre><code>guard let jsonData = try? encoder.encode(dataForSave) else { return false }
  </code></pre>
  <p>How can I improve encoding/decoding time and amount of RAM memory?</p>