title: How to reduce time to load a pickle file in python or map a pickle file to disk
body: <p>I want to load pickle file of size 4.23GB.
  I use below code to load the data:</p>
  <pre><code>import _pickle as cPickle
  def read_pickle(file):
      try:
          with open(file, &quot;rb&quot;) as input_file:
              data = cPickle.load(input_file)
              return data
      except Exception as e:
          print(&quot;Error in reading data from pickle file&quot;,e)
  </code></pre>
  <p>SyStem Configuration: 16Cores 32GB RAM</p>
  <p>Output:</p>
  <pre><code>%time data=read_pickle(file)
  
  CPU times: user 5.79 s, sys: 1.21 s, total: 7 s
  Wall time: 7 s
  
  </code></pre>
  <p>As multiple user are using this in code so I want to load this file once in my code and use its return data each and every time is there anyway to map this file to disk to avoid load file every time or reduce loading time.</p>