KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I'm working on my solution to the Cult of the Bound Variable problem. Part of the problem has you implement an interpreter for the "ancient" Universal Machine. I've implemented an intepreter for the machine they describe and now I'm running a benchmark program that the university provided to test it. My C# implementation of this interpreter is slow ! I fired up my program in the ANTS profiler to see where the slowdown is and I can see that over 96% of my time is taken up by the "Load Program" operation. The specification of this operator is as follows: #12. Load Program. The array identified by the B register is duplicated and the duplicate shall replace the '0' array, regardless of size. The execution finger is placed to indicate the platter of this array that is described by the offset given in C, where the value 0 denotes the first platter, 1 the second, et cetera. The '0' array shall be the most sublime choice for loading, and shall be handled with the utmost velocity. Here is my code for this operator: case 12: // Load Program _platters[0] = (UInt32[])_platters[(int)_registers[B]].Clone(); _finger = _registers[C]; break; The source code to my whole "Universal Machine" interpreter is here . What can I do to make this faster? There are other implementations of this interpreter written in C which complete the entire benchmark significantly faster.
Tags (comma-separated)
Save Edits
Cancel