test delete or set to false

Benchmark created on


Setup

const model = {}

const skus = [{
	availableOnline: true
}, {
	availableOnline: false
}, {
	availableOnline: true
}, {
	availableOnline: false
}];

Test runner

Ready to run.

Testing in
TestOps/sec
baseline
model.isNotAvailableOnline = true;
model.isNotAvailable = model.isNotAvailableOnline;

skus.reduce((agg, sku) => {
	if (model.isNotAvailableOnline && sku.availableOnline) {
            delete model.isNotAvailableOnline;
            delete model.isNotAvailable;
        }
}, model)
ready
exp
model.isNotAvailableOnline = true;
model.isNotAvailable = true;

skus.reduce((agg, sku) => {
	if (model.isNotAvailableOnline && sku.availableOnline) {
            model.isNotAvailableOnline = false;
            model.isNotAvailable = false;
        }
}, model)
ready

Revisions

You can edit these tests or add more tests to this page by appending /edit to the URL.