User loginNavigation |
archivesSnakes all the way downVirtual machines (VMs) emulating hardware devices are gen- erally implemented in low-level languages for performance reasons. This results in unmaintainable systems that are difficult to understand. In this paper we report on our experience using the PyPy toolchain to improve the portability and reduce the complexity of whole-system VM implementations. As a case study we implement a VM prototype for a Nintendo Game Boy, called PyGirl , in which the high-level model is separated from low-level VM implementation issues. We shed light on the process of refactoring from a low-level VM implementation in Java to a high-level model in RPython. We show that our whole-system VM written with PyPy is significantly less complex than standard imple- mentations, without substantial loss in performance. * We show how the execution and implementation details of WSVMs are separated in the same way as those of HLLVMs.(groan, since when did Java become the gold standard for "fast"? I know, I know, "with a sufficiently advanced JIT...") (I (sincerely, seriously) apologize if this is not nearly theoretical enough for a forum like LtU.) Function Readability & UnderstandabilityTwo versions of the same function in JavaScript because its a language that supports both the functional and imperative style. The function accepts any number of arrays as arguments, and outputs the permutations of the values so (['a', 'b'],['1', '2']) becomes [['a', '1'], ['a', '2'], ['b', '1'], ['b', '2']]: function permutations1(x) { return x.reduce(function(a0, v0) { return a0.reduce(function(a1, v1) { return a1.concat(v0.map(function(v2) { return v1.concat([v2]); })); }, []); }, [[]]); } function permutations2(x) { var a = [[]]; for (var i = 0; i < x.length; ++i) { var b = []; for (var j = 0; j < a.length; ++j) { for (var k = 0; k < x[i].length; ++k) { b.push(a[j].concat([x[i][k]])); } } a = b; } return a; } Which do you find easier to read and understand, and if you find one easier, what do you think the reasons are? |
Browse archivesActive forum topics |
Recent comments
22 weeks 2 days ago
22 weeks 2 days ago
22 weeks 2 days ago
44 weeks 4 days ago
48 weeks 6 days ago
50 weeks 3 days ago
50 weeks 3 days ago
1 year 1 week ago
1 year 5 weeks ago
1 year 5 weeks ago