From 3108a373d741ffe54634c14cb36ce8c19c2058bd Mon Sep 17 00:00:00 2001 From: Adrian Conlon Date: Fri, 15 Feb 2019 09:10:27 +0000 Subject: [PATCH] Interesting: in profiling, creating the mapping object was one of the major bottlenecks, when running the M6502 test suite. Signed-off-by: Adrian Conlon --- M6502/M6502.Test/Board.cs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/M6502/M6502.Test/Board.cs b/M6502/M6502.Test/Board.cs index 441860f..8a29c92 100644 --- a/M6502/M6502.Test/Board.cs +++ b/M6502/M6502.Test/Board.cs @@ -14,6 +14,7 @@ namespace M6502.Test private readonly M6502 cpu; private readonly Symbols symbols; private readonly Disassembly disassembler; + private readonly MemoryMapping mapping; private ushort oldPC; @@ -24,6 +25,7 @@ namespace M6502.Test this.cpu = new M6502(this); this.symbols = new Symbols(); this.disassembler = new Disassembly(this, this.cpu, this.symbols); + this.mapping = new MemoryMapping(this.ram, 0x0000, (ushort)Mask.Mask16, AccessLevel.ReadWrite); this.oldPC = (ushort)Mask.Mask16; } @@ -65,10 +67,7 @@ namespace M6502.Test this.cpu.PokeWord(0x01, this.configuration.StartAddress); } - public override MemoryMapping Mapping(ushort absolute) - { - return new MemoryMapping(this.ram, 0x0000, (ushort)Mask.Mask16, AccessLevel.ReadWrite); - } + public override MemoryMapping Mapping(ushort absolute) => this.mapping; private void CPU_ExecutedInstruction(object sender, System.EventArgs e) {