Rhinoscriptsyntax - Add Object, redraw - performance

playing arround with the new Rhinocode Editor i noticed, that many / all (?) rhinoscript syntax functions, that add geometry to the document, call:

doc.Views.Redraw()

in old times with vb-script based rhinoscript, it was a huge performance increase to turn of redraw and only redraw at the end of a command.

Is this obsolete with the latest Display Pipeline ?

example:
FILE .rhinocode/python3.9-32/site-rhinopython/rhinoscript/curve.py
LINE 221 onward

def AddCurve(points, degree=3):
    points = rhutil.coerce3dpointlist(points, True)
    curve = Rhino.Geometry.Curve.CreateControlPointCurve(points, degree)
    if not curve: raise Exception("unable to create control point curve from given points")
    rc = scriptcontext.doc.Objects.AddCurve(curve)
    if rc==System.Guid.Empty: raise Exception("Unable to add curve to document")
    scriptcontext.doc.Views.Redraw()
    return rc

just stumbled across ist and was wondering.
no actual use case - skipping rhinoscript syntax and use rhinocommon.
kind regards - tom

Hi,
It is still painfully slow
Disabling redraw always increase performance (drastically so)

Farouk

rs.EnableRedraw()

further digging …
…ok it seams like the line in the rhinoscriptsyntax-implementation - I was wondering about (see above, Line 221)
scriptcontext.doc.Views.Redraw()
has no effect, when
rs.EnableRedraw(False)

I was not aware of this hierarchy / dependency.
Maybe would be nice to add it to the documentation.

example

the 3rd row of points will show that Redraw() is doing nothing…

import rhinoscriptsyntax as rs
import scriptcontext as sc

num = 5
time = 100
#point by point
for i in range(num):
    rs.AddPoint(i,0,0)
    rs.Sleep(time)
    
# no redraw
rs.EnableRedraw(False)
for i in range(num):
    rs.AddPoint(i,1,0)
    rs.Sleep(time)
rs.EnableRedraw(True)

# redraw without effect
rs.EnableRedraw(False)
for i in range(num):
    rs.AddPoint(i,2,0)
    # no impact by Redraw 
    sc.doc.Views.Redraw()
    rs.Sleep(time)
rs.EnableRedraw(True)

thanks for your post.
kind regards -tom