BHoM / BHoM/BHoM_Engine

Diffing_Engine: profiling

Open
#1,119 7 comments 0 reactions 1 assignee Claimed by @alelom View on GitHub
type:test-script
Dominant language
C#
Stars
30
Forks
13
Avg merge
7d 10h
Merged PRs (30d)
5

Description

Create profiling tests and record results.

I will edit this post with added tests.

# ProfilingTest_01 - bars only

Test file: https://github.com/BHoM/BHoM_Engine/blob/Diffing_Engine-initialImplementation/Engine_Test/Diffing_Engine/Profiling01.cs

## Execution time
Here I'm testing `BH.oM.Structure.Bars` only.

![image](https://user-images.githubusercontent.com/6352844/61963784-58379800-afc4-11e9-9600-75f1209eed7f.png)

Collection-level diffing only:
- From 10 to 20000 elements the algorithm seems to have an efficiency of `O(n log n)`.
- Numbers larger than 20000 the efficiency drops: haven't let it run yet but I fear much more than that.

Collection AND Property-level diffing :
- Efficiency much lower, close to `n²` for relatively small numbers (5000).

## Cpu profile

* A big, probably unnecessary performance hit is caused by how we are forced to retrieve a specific fragment:
![image](https://user-images.githubusercontent.com/6352844/61909886-245c6400-af2b-11e9-8ec6-7f2aa9616722.png)
This might be food for thought on how we implemented the Fragments.

* However, the largest percentage is lost in the following section, which I can definitely improve
![image](https://user-images.githubusercontent.com/6352844/61909997-5f5e9780-af2b-11e9-83c4-66ede2c0de42.png)

### Conclusions
- There is definitely room for improvement. I can rewrite code to make it more efficient, for now I only wanted to finish the prototype.
- What if I used CustomData instead of Fragment to save the hashes? Just getting the right fragment has a certain cost.

# Other profiling tests
Other tests are needed to account for different cases:
- types of elements: elements with a deep/complex/heavy class structure (Panels? Meshes?)
- variety of elements: mixed types
- others to be defined

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.