computing the inverse of a large block diagonal sparse matrix in r

I would like to compute the inverse of some large block diagonal sparse matrix. The number of rows and columns is somewhat over 50,000. The blocks are 12 by 12 and are sparse (27 non zero elements).

I tried to compute the inverse of the entire matrix (using solve). This was not possible, the entire matrix is too big.

After that, i use a for-loop. Within each iteration, i take out one block, compute its inverse and place it back.

That method works, but iT takes about 5 minutes. I wonder if there is some faster way.