Skip to content

Performance issue for create object in RhinoPython #649

@yck011522

Description

@yck011522

Describe the bug
Creating object is very slow in RhinoPython. There seems to be a memory leak.
compas.version = '0.17.1' pulled from source e5b1e23

To Reproduce
This function test3() creates 3 lines, the test runs this 100 times:

from compas.geometry import Line

def test3():
    line1 = Line([-100, 0, 0], [100, 0, 0])
    line2 = Line([0, -100, 0], [0, 100, 0])
    line3 = Line([0, -100, 10], [0, 100, 10])

if __name__ == "__main__":
    import datetime

    first_time = datetime.datetime.now()
    for i in range(100):
        test3()
    later_time = datetime.datetime.now()
    difference = later_time - first_time
    print("Time took: %s" % difference)

Running this is cPython 3.7
Time took: 0:00:00.004987

Running this in Rhino (fresh after ResetScriptEngine)
Time took: 0:00:00.051000
Subsequent runs:
Time took: 0:00:00.319000
Time took: 0:00:00.490000
Time took: 0:00:01.155000
Time took: 0:00:01.173000
Time took: 0:00:01.154000
Time took: 0:00:02.093000
Time took: 0:00:02.136000
Time took: 0:00:02.133000
Time took: 0:00:02.648000
you get the idea, it keeps going up... until Rhino never returns (aka crash)

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions