backburner.js icon indicating copy to clipboard operation
backburner.js copied to clipboard

unify cancelation:

Open stefanpenner opened this issue 8 years ago • 8 comments

https://github.com/BackburnerJS/backburner.js/blob/master/lib/backburner/queue.ts#L139-L180

rather then doing splicing lets just null out always

@bekzod thoughts?

stefanpenner avatar May 22 '17 15:05 stefanpenner

sounds good I think, splice has performance implications as I have heard (haven't benchmarked myself) also cancel is not frequently used method

bekzod avatar May 23 '17 10:05 bekzod

surprise surprise #227 I will let benchmark to speak to itself

Cancel - no timer ............................................................... 29,767,632.00 op/s Schedule & Cancel - function ........................................................ 30,406.16 op/s Schedule & Cancel - target, function ................................................ 36,787.48 op/s Schedule & Cancel - target, string method name ...................................... 29,762.83 op/s Schedule & Cancel - target, string method name, 1 argument .......................... 50,260.97 op/s Schedule & Cancel - target, string method name, 2 arguments ......................... 42,101.87 op/s Schedule & Cancel - prescheduled, same queue - target, string method name ........... 76,889.89 op/s Schedule & Cancel - prescheduled, separate queue - target, string method name ....... 83,361.58 op/s

bekzod avatar May 23 '17 10:05 bekzod

this is current master Cancel - no timer ............................................................... 64,863,814.30 op/s Schedule & Cancel - function ..................................................... 3,190,839.04 op/s Schedule & Cancel - target, function ............................................. 3,049,007.76 op/s Schedule & Cancel - target, string method name ................................... 3,273,669.80 op/s Schedule & Cancel - target, string method name, 1 argument ....................... 3,189,777.45 op/s Schedule & Cancel - target, string method name, 2 arguments ...................... 3,033,343.78 op/s Schedule & Cancel - prescheduled, same queue - target, string method name ........ 1,074,390.96 op/s

bekzod avatar May 23 '17 10:05 bekzod

oh wait, i think I misread this.

stefanpenner avatar May 23 '17 15:05 stefanpenner

sorry first time i was excited too early too without checking current master benchmark

bekzod avatar May 23 '17 15:05 bekzod

Im surprised that #227 regresses so much.

stefanpenner avatar May 23 '17 15:05 stefanpenner

Ah, i wonder if it is actually a realistic example. It could be that in benchmark land without the splice we keep growing the array, and with who do not. But in reality that may not be a problem?

Likely warrants further investigation

stefanpenner avatar May 23 '17 15:05 stefanpenner

in real case maybe cancel will not be called that much as in benchmark and will have better results

bekzod avatar May 23 '17 15:05 bekzod