Improving performance of moving arrays into an array I am loading a bunch of arrays and putting them into a single array.  The loading of the data is negligible, but putting it into combinedArray takes significant time (as in this code). 

import time
import numpy as np
start_time = time.time()

   st,en = 0,0
   combinedArray = np.empty(shape = (30000*30000))
   #Get the array that each process wrote to
   for i in range(10):
       #load the array
       #ex loading 
       X_np = np.empty(shape = (30000*30000)/10)
       st = en
       en += np.shape(X_np[:])[0]
       #add to the array list
       combinedArray[st:en] = X_np[:]

   print("Array Calc:",time.time()-start_time)  


What I have found is often someone talking about not using append, so I tried with creating the array first, but just moving it is time consuming.  Any advice on how to optimize this is appreciated.
I tried some alternative approaches, and got this result:

Time for orig: 0.15900921821594238
Time for concat: 0.18401050567626953
Time for block: 0.16700983047485352
Time for stack_ravel: 0.1760098934173584
Time for stack_flatten: 0.32501864433288574


It's worth pointing out that I'm on a 32-bit machine with not enough RAM to hang with you. So I used smaller arrays. You'll want to correct the code and try for yourself. Also, my validation is really minimal, so you should probably improve that as well.

import time
import numpy as np

COMBINED_SHAPE = (3_000 * 3_000)

def time_func(f):
    start_time = time.time()
    ca = f()
    assert np.shape(ca)[0] == COMBINED_SHAPE
    print(f"Time for {f.__name__}:", time.time() - start_time)

def load_partial():
    partial = np.empty(shape=(COMBINED_SHAPE // 10))
    return partial

def orig():
    st, en = 0, 0
    combined_array = np.empty(shape=COMBINED_SHAPE)

    for i in range(10):
        X_np = load_partial()
        st = en
        en += np.shape(X_np[:])[0]
        combined_array[st:en] = X_np[:]

    return combined_array

def concat():
    ca = np.concatenate([load_partial() for _ in range(10)])
    return ca

def block():
    ca = np.block([load_partial() for _ in range(10)])
    return ca

def stack_ravel():
    ca = np.stack([load_partial() for _ in range(10)])
    ca = np.ravel(ca)
    return ca

def stack_flatten():
    ca = np.stack([load_partial() for _ in range(10)]).flatten()
    return ca


if __name__ == '__main__':
    time_func(orig)
    time_func(concat)
    time_func(block)
    time_func(stack_ravel)
    time_func(stack_flatten)