Implements copy-on-write as discussed in #5 (closed). This is still a work-in-progress.
The test test_BinaryMethod
seems to fail from time to time. I have to further investigate this.
Start 19: Scenario: Calls to functions of super class
19: Test command: /home/jp/Programming/MA/elsa/build/elsa/projectors/tests/test_BinaryMethod "Scenario: Calls to functions of super class"
19: Test timeout computed to be: 9.99988e+06
19: Filters: Scenario: Calls to functions of super class
19: [2019-10-09 17:18:21.188] [Timing] [info] Execution of BinaryMethod: apply took 4 ms
19: [2019-10-09 17:18:21.204] [Timing] [info] Execution of BinaryMethod: apply took 15 ms
19:
19: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
19: test_BinaryMethod is a Catch v2.8.0 host application.
19: Run with -? for options
19:
19: -------------------------------------------------------------------------------
19: Scenario: Calls to functions of super class
19: Given: A projector
19: When: Projector is cloned
19: Then: Results do not change (may still be slightly different due to
19: summation being performed in a different order)
19: -------------------------------------------------------------------------------
19: /home/jp/Programming/MA/elsa/elsa/projectors/tests/test_BinaryMethod.cpp:465
19: ...............................................................................
19:
19: /home/jp/Programming/MA/elsa/elsa/projectors/tests/test_BinaryMethod.cpp:468: FAILED:
19: REQUIRE( sino == sinoClone )
19: with expansion:
19: {?} == {?}
19:
19: ===============================================================================
19: test cases: 1 | 1 failed
19: assertions: 1 | 1 failed
19:
19/36 Test #19: Scenario: Calls to functions of super class ..................................***Failed 0.02 sec
Benchmark results
I did a quick memory profiling with valgrind --tool=massif ...
using the example2d
. It seems that the CoW implementation does its job. Further benchmarking with larger examples necessary.
Results with CoW:
--------------------------------------------------------------------------------
n time(i) total(B) useful-heap(B) extra-heap(B) stacks(B)
--------------------------------------------------------------------------------
65 637,923,233 514,224 450,874 63,350 0
Results w/o CoW:
--------------------------------------------------------------------------------
n time(i) total(B) useful-heap(B) extra-heap(B) stacks(B)
--------------------------------------------------------------------------------
81 568,530,524 784,632 721,218 63,414 0
Next steps
- investigate test failure
- write test cases
- extensive benchmarks