From 44ae084794c52afdf0d15173398760648a01861f Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Wed, 18 May 2022 17:10:05 -0400 Subject: [PATCH] Avoid the repeated .fill; reduces debug-build executor test time to 1.5s. i.e. eliminates about 95% of costs. --- .../Mac/Clock SignalTests/68000ComparativeTests.mm | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/OSBindings/Mac/Clock SignalTests/68000ComparativeTests.mm b/OSBindings/Mac/Clock SignalTests/68000ComparativeTests.mm index 88d2702b0..071358957 100644 --- a/OSBindings/Mac/Clock SignalTests/68000ComparativeTests.mm +++ b/OSBindings/Mac/Clock SignalTests/68000ComparativeTests.mm @@ -135,6 +135,13 @@ struct TestProcessor: public CPU::MC68000Mk2::BusHandler { } - (void)setUp { + // Definitively erase any prior memory contents; + // 0xce is arbitrary but hopefully easier to spot + // in potential errors than e.g. 0x00 or 0xff. + _ram.fill(0xce); + + // TODO: possibly, worry about resetting RAM to 0xce after tests have completed. + #ifdef USE_EXECUTOR _testExecutor = std::make_unique(_ram.data()); #endif @@ -217,7 +224,6 @@ struct TestProcessor: public CPU::MC68000Mk2::BusHandler { - (void)testOperationClassic:(NSDictionary *)test name:(NSString *)name { auto uniqueTest68000 = std::make_unique(_ram.data()); auto test68000 = uniqueTest68000.get(); - _ram.fill(0xce); { // Apply initial memory state. @@ -296,11 +302,6 @@ struct TestProcessor: public CPU::MC68000Mk2::BusHandler { } - (void)setInitialState:(NSDictionary *)test { - // Definitively erase any prior memory contents; - // 0xce is arbitrary but hopefully easier to spot - // in potential errors than e.g. 0x00 or 0xff. - _ram.fill(0xce); - // Apply initial memory state. NSArray *const initialMemory = test[@"initial memory"]; NSEnumerator *enumerator = [initialMemory objectEnumerator];