Creating many layers efficiently

Is it possible to add many say thousands of layers to rhino using rhino python without freezing the view? When I create more than 10 layers rhino will freeze and create the layers in the background. Is it possible to do this without freezing rhino so to say more efficiently?
I am currently using
Layername =Rhino.DocObjects.Layer()
And scriptcontext.doc.Layers.Add(Layername)
Thanks!

Hi Mosser,

You can disable the views redraw:

import scriptcontext as sc
import Rhino

layer = Rhino.DocObjects.Layer()
sc.doc.Views.RedrawEnabled = False

for i in range(1000):
    layer.Name = "someLayer_%s" % i
    sc.doc.Layers.Add(layer)

sc.doc.Views.RedrawEnabled = True

Yes thank you that provided aaaalot of speed-up :smiley: