The first one should be much faster. However, note that those two lists are not equivalent. The first one has y
entries, while he second one has block_length
entries. If y
is very large (i.e. because you are splitting a very long list into relatively small blocks) this could account for the difference in running time.
Probably you meant this instead:
block = data[y * block_length : (y + 1) * block_length]