title: How to split a memory consuming computation into parts and then save and load each parts?
body: <p>I wrote this Python 3 code to bench mark some computation.</p>
  
  <p>unfortunately it crashes my 30GB memory when n is equal or greater than 3.</p>
  
  <pre><code>def benchmking(n=0):
      import time
      items = range(int(10**(6+n)))
      def f2(x):return x*x
  
      start = time.time()
      squared = list(map(f2, items))
      return time.time() - start
  </code></pre>
  
  <p>I admit that this code is memory consuming.</p>
  
  <p>One possible solution I can imagine is split the computation and save the results into file system, but how?</p>
  
  <h1>question</h1>
  
  <p>I was trying to benchmark a big computation both with regular and parallel approaches. Now I am trying to save the intermediate computation.</p>