SwiftBuilder icon indicating copy to clipboard operation
SwiftBuilder copied to clipboard

Test/measure

Open ytyubox opened this issue 5 years ago • 0 comments

This PR Delete the Operator + and -, in case of the performance result. Here's the result of struct for creating over 1_000_000 objects with 60 steps of assign.

1. PerformanceForAnonymousFunction

code

let _:TargetData = {
    var object = TargetData()
    object.value01 = value
    ...
}()

result

Test Case '-[FluentInterfaceTests.PerformanceTests testPerformanceForAnonymousFunction]' 
measured [Time, seconds]
average: 0.853, relative standard deviation: 6.228%,
values: [0.860029, 0.872155, 0.846942, 0.913310, 0.966266, 0.818084, 0.865597, 0.805299, 0.786005, 0.796726]

2. Test with FI but no operator

code:

_ =  FluentInterface(subject: TargetData())
       .value1(value)
       ....
       .unwrappingSubject()

result

Test Case '-[FluentInterfaceTests.PerformanceTests testPerformanceForFluentInterfaceWithoutOperator]' 
measured [Time, seconds]
average: 0.300, relative standard deviation: 1.791%,
values: [0.314669, 0.300544, 0.295156, 0.299124, 0.295934, 0.297903, 0.300905, 0.295507, 0.301754, 0.298032]

3. Test with both FI and operator

code

_ =  TargetData()+
       .value1(value)
       ....
       .unwrappingSubject()

result

Test Case '-[FluentInterfaceTests.PerformanceTests testPerformanceForFluentInterface]' 
measured [Time, seconds]
average: 31.903, relative standard deviation: 1.653%,
values: [31.434002, 32.345789, 31.874028, 32.196870, 32.072988, 31.607050, 32.087261, 31.928967, 32.762648, 30.725121]

ytyubox avatar Mar 14 '20 09:03 ytyubox