BHoM / BHoM_UI

GNU Lesser General Public License v3.0
9 stars 5 forks source link

BHoM_UI: Enforce immutability at the level of the UI #189

Closed adecler closed 4 years ago

adecler commented 6 years ago

This issue has been archived

Historic issue archive can be found here

adecler commented 5 years ago

Doing should be as easy as a couple of lines on the BHoM_UI repo: replace the inputs with a deep cloned version if the method is a Modify or Compute method and then pass them along as normal.

The alternative is to make sure that every code writer is taking care of immutability on the level of the function they are writing. This can be a lot faster since it is strategic cloning (not, systematic deep clone) but is a overhead on the people.

In order, to chose between tho two, we need to test the loss in computational efficiency of the first option. Let's consider a worst case scenario of just changing the name of an object and compare the case of deep cloning happening on the UI level or not. If the loss of computational efficiency is less than 10%, I think this is worth it. More, we need to discuss.

@IsakNaslundBh , @FraserGreenroyd , can you provide a typical large object that I can test the efficiency loss on?

IsakNaslundBh commented 5 years ago

@adecler some objects of varying size as well as some current modify methods stored here:

https://burohappold.sharepoint.com/:u:/r/sites/BHoM/02_Current/12_Scripts/01_Test%20Scripts/Grasshopper_Toolkit/Grasshopper_Toolkit-Issue232-ImmutabilityOfObjects/Grasshopper_Toolkit-Issue232-ImmutabilityOfObjects.gh?csf=1&e=v9zfcL

FraserGreenroyd commented 5 years ago

Hi @adecler sorry for the (very) late reply to this - I've uploaded a JSON file of some complex BEnv objects that we use for our testing purposes that may be beneficial to this: https://burohappold.sharepoint.com/sites/BHoM/_layouts/15/download.aspx?UniqueId=51574f95f9c24651b4792eb4ad1fc36c&e=Jahf2M

Hope this helps. I'm unassigning myself only because I won't likely be the person actively resolving the issue raised here, but will stay subscribed for updates and happy to be reassigned if my involvement is needed further :smile: