Mass Instance an Object Slows Down Drastically


I have a performance problem when creating a simple brick wall and I wonder if you have any tips or advices for me? :)

I want to create a brick wall from a list of instances.
If I work with a fair amount of instances everything works like a charm. But if I increase my amount over ca. 500 objects it slows down drastically.

I already turned off undo and disabled scene redraw...

Thank you in advance! :)

PS: I am an absolutely beginner in maxscript :/ ...

fn UpdateWall =
	setCommandPanelTaskMode mode:#modify
	suspendEditing which:#modify
	undo off
	local x = 1
	for i=1 to num_length.value by 1 do
		start = timestamp()
		for k=1 to num_height.value by 1 do
			local randBrick = pickedObjects[(random 1 pickedObjects.count)] -- pick random "brick" from brick array
			if x > wallContainer.count then wallContainer[x] = instance randBrick --instance new "bricks" when array grows
			local brick = wallContainer[x]
			brick.pos.x = (stair_offset.value * (k-1))
			brick.pos.y = (padding_length.value * (i-1) + ((mod k 2) * rowOffset.value))
			brick.pos.z = (padding_height.value * (k-1))
			x += 1
		end = timestamp()
		format "iteration % took % seconds\n" i ((end-start)/1000.0)
	for item in x to wallContainer.count do
		delete wallContainer[x]
		deleteItem wallContainer x
	resumeEditing which:#modify