### Initializing Git Submodules and Installing NPM Dependencies Source: https://github.com/slightlyoff/cassowary.js/blob/master/README.md This snippet shows the commands required to initialize Git submodules and install NPM dependencies for the Cassowary.js project. These steps are necessary to set up the development environment and run tests. ```Shell git submodule update --init ``` ```Shell npm install ``` -------------------------------- ### Expression Construction Example Source: https://github.com/slightlyoff/cassowary.js/blob/master/redesign_notes.md Demonstrates the construction of a `c.Expression` with variables as arguments. This example highlights that expressions can be created without explicitly referencing a solver, which can lead to issues in real-world usage where solver context is crucial. ```javascript // From Expression-test.js describe('c.Expression', function () { it('is constructable with 3 variables as arguments', function () { var x = new c.Variable({ name: 'x', value: 167 }); var e = new c.Expression(x, 2, 3); assert.deepEqual(e+'', '3 + 2*167'); }); // ... }); ``` -------------------------------- ### Deoptimization of get in HashTable Source: https://github.com/slightlyoff/cassowary.js/blob/master/perf/opt_deopt.txt This snippet shows the deoptimization process of the `get` function within the `HashTable` class. It includes the bailout number, address, frame size, and the state of the stack during the deoptimization. ```JavaScript **** DEOPT: c.HashTable.c.inherit.get at bailout #19, address 0x0, frame size 8 [deoptimizing: begin 0x60f30455 c.HashTable.c.inherit.get @19] translating c.HashTable.c.inherit.get => node=27, height=4 0xfff178b8: [top + 24] <- 0x50375a05 ; edx 0x50375a05 0xfff178b4: [top + 20] <- 0x60f4d2a9 ; eax 0x60f4d2a9 0xfff178b0: [top + 16] <- 0x3c9569c9 ; caller's pc 0xfff178ac: [top + 12] <- 0xfff178c8 ; caller's fp 0xfff178a8: [top + 8] <- 0x60f080a5 ; context 0xfff178a4: [top + 4] <- 0x60f30455 ; function 0xfff178a0: [top + 0] <- 0x000002a0 ; ecx 336 [deoptimizing: end 0x60f30455 c.HashTable.c.inherit.get => node=27, pc=0x3c92ef9a, state=TOS_REG, took 0.012 ms] [removing optimized code for: c.HashTable.c.inherit.get] ``` -------------------------------- ### Deoptimization of get in HashTable (bailout #8) Source: https://github.com/slightlyoff/cassowary.js/blob/master/perf/opt_deopt.txt This snippet shows another deoptimization process of the `get` function within the `HashTable` class, specifically at bailout #8. It includes stack information and also the deoptimization of the `keyCode` function. ```JavaScript **** DEOPT: c.HashTable.c.inherit.get at bailout #8, address 0x0, frame size 12 [deoptimizing: begin 0x60f30455 c.HashTable.c.inherit.get @8] translating c.HashTable.c.inherit.get => node=29, height=4 0xfff178c0: [top + 24] <- 0x50375cc9 ; [esp + 32] 0x50375cc9 0xfff178bc: [top + 20] <- 0x50375d7d ; eax 0x50375d7d 0xfff178b8: [top + 16] <- 0x3c94e22f ; caller's pc 0xfff178b4: [top + 12] <- 0xfff178cc ; caller's fp 0xfff178b0: [top + 8] <- 0x60f080a5 ; context 0xfff178ac: [top + 4] <- 0x60f30455 ; function 0xfff178a8: [top + 0] <- 0x60f30245 ; [esp + 4] 0x60f30245 translating keyCode => node=40, height=4 0xfff178a4: [top + 24] <- 0x50308091 ; literal 0xfff178a0: [top + 20] <- 0x50375d7d ; eax 0x50375d7d 0xfff1789c: [top + 16] <- 0x3c92ef94 ; caller's pc 0xfff17898: [top + 12] <- 0xfff178b4 ; caller's fp 0xfff17894: [top + 8] <- 0x60f080a5 ; context 0xfff17890: [top + 4] <- 0x60f30245 ; function 0xfff1788c: [top + 0] <- 0x50308091 ; literal [deoptimizing: end 0x60f30245 keyCode => node=40, pc=0x3c92e8d7, state=NO_REGISTERS, took 0.023 ms] [removing optimized code for: c.HashTable.c.inherit.get] ``` -------------------------------- ### Recompilation of HashTable functions Source: https://github.com/slightlyoff/cassowary.js/blob/master/perf/opt_deopt.txt This snippet shows the functions `put` and `get` within the `HashTable` class being marked for recompilation. The reasons include being a small function and having a high percentage of ICs with type information. ```JavaScript [marking c.HashTable.c.inherit.put 0x60f0810c for recompilation, reason: small function, ICs with typeinfo: 15/16 (93%)] [optimizing: c.HashTable.c.inherit.put / 60f0810d - took 0.510 ms] [marking c.HashTable.c.inherit.get 0x60f30454 for recompilation, reason: small function, ICs with typeinfo: 5/5 (100%)] [optimizing: c.HashTable.c.inherit.get / 60f30455 - took 0.344 ms] ``` -------------------------------- ### Initializing and Using Cassowary Solver in Node.js Source: https://github.com/slightlyoff/cassowary.js/blob/master/README.md This snippet demonstrates how to import the Cassowary library in a Node.js environment, create a solver instance, define variables, create an equation, and add it as a constraint to the solver. It showcases the basic steps for utilizing Cassowary to solve constraint-based layouts. ```JavaScript var c = require("cassowary"); var solver = new c.SimplexSolver(); var x = new c.Variable({ value: 167 }); var y = new c.Variable({ value: 2 }); var eq = new c.Equation(x, new c.Expression(y)); solver.addConstraint(eq); ``` -------------------------------- ### Running Tests Using NPM Source: https://github.com/slightlyoff/cassowary.js/blob/master/README.md This snippet shows the command to run the test suite for Cassowary.js using NPM. This command executes the test scripts defined in the package.json file. ```Shell npm test ``` -------------------------------- ### SimplexSolver minRatio Optimization Source: https://github.com/slightlyoff/cassowary.js/blob/master/perf/opt_deopt.txt This log entry indicates that the `minRatio` function within the `SimplexSolver` class is being optimized. The log shows the function address and the time it took for optimization. ```JavaScript [optimizing: c.SimplexSolver.c.inherit.optimize.minRatio / 60a83159 - took 0.093 ms] ``` -------------------------------- ### Simplex Solver Min Ratio Recompilation Source: https://github.com/slightlyoff/cassowary.js/blob/master/perf/opt_deopt.txt This snippet shows the recompilation of the `minRatio` method within the `SimplexSolver` class. The recompilation is triggered due to the function's small size and the presence of inline caches with partial type information. ```JavaScript c.SimplexSolver.c.inherit.optimize.minRatio ``` -------------------------------- ### LinearExpression Initialization Deoptimization Source: https://github.com/slightlyoff/cassowary.js/blob/master/perf/opt_deopt.txt This log shows the deoptimization process for the `c.LinearExpression.c.inherit.initialize` function. It details the state of the stack and registers during the deoptimization, indicating a bailout occurred at a specific point in the code. This information can be used to understand why the optimized code was abandoned and to identify potential issues in the function's implementation. ```JavaScript **** DEOPT: c.LinearExpression.c.inherit.initialize at bailout #19, address 0x0, frame size 16 [deoptimizing: begin 0x503d02bd c.LinearExpression.c.inherit.initialize @19] translating c.LinearExpression.c.inherit.initialize => node=113, height=0 0xfff17930: [top + 28] <- 0x608f21e5 ; ecx 0x608f21e5 0xfff1792c: [top + 24] <- 0x60c96c1d ; [esp + 40] 0x60c96c1d 0xfff17928: [top + 20] <- 0x50308091 ; ebx 0x50308091 0xfff17924: [top + 16] <- 0x50308091 ; [esp + 32] 0x50308091 0xfff17920: [top + 12] <- 0x3c90db41 ; caller's pc 0xfff1791c: [top + 8] <- 0xfff17940 ; caller's fp 0xfff17918: [top + 4] <- 0x503d02e1 ; context 0xfff17914: [top + 0] <- 0x503d02bd ; function [deoptimizing: end 0x503d02bd c.LinearExpression.c.inherit.initialize => node=113, pc=0x3c9439f0, state=NO_REGISTERS, took 0.020 ms] [removing optimized code for: c.LinearExpression.c.inherit.initialize] ``` -------------------------------- ### Proposed Solver-Oriented API Source: https://github.com/slightlyoff/cassowary.js/blob/master/redesign_notes.md Illustrates a proposed solver-oriented API for Cassowary.js. This API emphasizes the central role of the solver in creating and managing variables and expressions, aiming to address the issues of cross-linkages and construction patterns in the current API. ```javascript // Retreive a reference to a solver (instanceof c.SimplexSolver or a facade). var solver = new c.get("solver name"); // Add a variable to the solver solver.var(/*required*/ "name", /*opt value*/ 10); // Retrieve the current value of the variable solver.value(/*required*/ "name") == 10; // This style of API starts with "expr()" and builds until it reaches a // terminal: either an "eq()", "leq()", "geq()", or "neq()" solver.expr(/*opt name*/).var("name").plus(10).eq(15); // Expressions may be referenced by name at expression construction time: solver.expr(/*opt name*/).expr("name").plus(10).eq(15); ``` -------------------------------- ### Variable initialize Recompilation and Optimization Source: https://github.com/slightlyoff/cassowary.js/blob/master/perf/opt_deopt.txt This log entry indicates that the `initialize` function within the `c.Variable.c.inherit` scope is being marked for recompilation. The reason provided is that it is a small function. The ICs with typeinfo ratio is 6/8 (75%). The log also shows that the function was optimized, and the optimization took 0.204 ms. ```JavaScript [marking c.Variable.c.inherit.initialize 0x503e2e20 for recompilation, reason: small function, ICs with typeinfo: 6/8 (75%)] ``` ```JavaScript [optimizing: c.Variable.c.inherit.initialize / 503e2e21 - took 0.204 ms] ``` -------------------------------- ### Optimizing SimplexSolver Function Source: https://github.com/slightlyoff/cassowary.js/blob/master/perf/opt_deopt.txt This log entry shows that the `setExternalVariables._fNeedsSolving` function within the `c.SimplexSolver` class is being optimized. The log also shows the time it took to optimize the function. ```log [optimizing: c.SimplexSolver.c.inherit.setExternalVariables._fNeedsSolving / 60d283b9 - took 0.275 ms] time = 0.265 ``` -------------------------------- ### Optimizing SimplexSolver.setExternalVariables._fNeedsSolving (Cassowary.js) Source: https://github.com/slightlyoff/cassowary.js/blob/master/perf/opt_deopt.txt This log entry indicates that the '_fNeedsSolving' function within the 'SimplexSolver.setExternalVariables' is being optimized and the time it took. ```JavaScript [optimizing: c.SimplexSolver.c.inherit.setExternalVariables._fNeedsSolving / 603f7c49 - took 0.563 ms] ``` -------------------------------- ### SimplexSolver Variable Setting Optimization in Cassowary.js Source: https://github.com/slightlyoff/cassowary.js/blob/master/perf/opt_deopt.txt This code snippet shows the recompilation and optimization of the '_fNeedsSolving' function within the 'setExternalVariables' method of the 'SimplexSolver' class in Cassowary.js. It includes information about the time taken for optimization. ```JavaScript [marking c.SimplexSolver.c.inherit.setExternalVariables._fNeedsSolving 0x6018fcbc for recompilation, reason: small function, ICs with typeinfo: 5/9 (55%)] [optimizing: c.SimplexSolver.c.inherit.setExternalVariables._fNeedsSolving / 6018fcbd - took 0.250 ms] ``` -------------------------------- ### SimplexSolver AddConstraint Deoptimization Source: https://github.com/slightlyoff/cassowary.js/blob/master/perf/opt_deopt.txt This snippet shows the deoptimization of the `addConstraint` method within the `SimplexSolver` class. The deoptimization occurs at bailout #101. The stack trace provides context about the function's state at the time of deoptimization, including the arguments and caller information. ```JavaScript **** DEOPT: c.SimplexSolver.c.inherit.addConstraint at bailout #101, address 0x0, frame size 108 [deoptimizing: begin 0x503e3f7d c.SimplexSolver.c.inherit.addConstraint @101] translating c.SimplexSolver.c.inherit.addConstraint => node=118, height=28 0xfff1797c: [top + 48] <- 0x5504b1fd ; [esp + 128] 0x5504b1fd 0xfff17978: [top + 44] <- 0x47cb7dd9 ; [esp + 124] 0x47cb7dd9 0xfff17974: [top + 40] <- 0x3c95daaa ; caller's pc 0xfff17970: [top + 36] <- 0xfff17a10 ; caller's fp 0xfff1796c: [top + 32] <- 0x503d0379 ; context 0xfff17968: [top + 28] <- 0x503e3f7d ; function 0xfff17964: [top + 24] <- 0x50308091 ; [esp + 84] 0x50308091 0xfff17960: [top + 20] <- 0x50308091 ; literal 0xfff1795c: [top + 16] <- 0x50308091 ; literal 0xfff17958: [top + 12] <- 0x503080c1 ; literal 0xfff17954: [top + 8] <- 0x50308091 ; literal 0xfff17950: [top + 4] <- 0x60cadc75 ; [esp + 88] 0x60cadc75 0xfff1794c: [top + 0] <- 0x60cadc1d ; [esp + 96] 0x60cadc1d ``` -------------------------------- ### SimplexSolver minRatio Recompilation Source: https://github.com/slightlyoff/cassowary.js/blob/master/perf/opt_deopt.txt This log entry indicates that the `minRatio` function within the `SimplexSolver` class is being marked for recompilation. The reason provided is that it's a small function, and the inline caches (ICs) have type information for 1 out of 2 calls (50%). ```JavaScript [marking c.SimplexSolver.c.inherit.optimize.minRatio 0x60a1de2c for recompilation, reason: small function, ICs with typeinfo: 1/2 (50%)] ``` -------------------------------- ### Adding Constraints in Cassowary.js (JavaScript) Source: https://github.com/slightlyoff/cassowary.js/blob/master/perf/opt_deopt.txt This log entry indicates the completion of adding 585 constraints to the Cassowary.js solver. It also provides information about the number of attempted constraints (5000) and the number of exceptions encountered during the process (0). This information is useful for monitoring the constraint solving process and identifying potential issues. ```JavaScript done adding 585 constraints [5000 attempted, 0 exceptions] ``` -------------------------------- ### LinearExpression AddVariable Deoptimization Source: https://github.com/slightlyoff/cassowary.js/blob/master/perf/opt_deopt.txt This log shows the deoptimization process for the `c.LinearExpression.c.inherit.addVariable` function. It provides insight into the stack and register states during deoptimization, specifically highlighting a bailout. This information is crucial for debugging and optimizing the variable addition process within linear expressions. ```JavaScript **** DEOPT: c.LinearExpression.c.inherit.addVariable at bailout #1, address 0x0, frame size 44 [deoptimizing: begin 0x503e3fc5 c.LinearExpression.c.inherit.addVariable @1] translating c.LinearExpression.c.inherit.addVariable => node=3, height=8 ``` -------------------------------- ### Optimizing SimplexSolver.setExternalVariables._fNeedsSolving (JavaScript) Source: https://github.com/slightlyoff/cassowary.js/blob/master/perf/opt_deopt.txt This log entry indicates that the `_fNeedsSolving` function within the `setExternalVariables` method of the `SimplexSolver` class is being optimized. It also provides the time taken for the optimization process (0.257 ms). This information is useful for monitoring the optimization process and identifying potential performance bottlenecks. ```JavaScript [optimizing: c.SimplexSolver.c.inherit.setExternalVariables._fNeedsSolving / 60cb8d05 - took 0.257 ms] ``` -------------------------------- ### SimplexSolver ChooseSubject Deoptimization Source: https://github.com/slightlyoff/cassowary.js/blob/master/perf/opt_deopt.txt This snippet shows the deoptimization of the `chooseSubject` method within the `SimplexSolver` class. The deoptimization occurs at bailout #22. The stack trace provides context about the function's state at the time of deoptimization, including the arguments and caller information. ```JavaScript **** DEOPT: c.SimplexSolver.c.inherit.chooseSubject at bailout #22, address 0x0, frame size 28 [deoptimizing: begin 0x503e4079 c.SimplexSolver.c.inherit.chooseSubject @22] translating c.SimplexSolver.c.inherit.chooseSubject => node=195, height=8 0xfff178f8: [top + 28] <- 0x5504b1fd ; [esp + 48] 0x5504b1fd 0xfff178f4: [top + 24] <- 0x60cadc75 ; [esp + 44] 0x60cadc75 0xfff178f0: [top + 20] <- 0x3c97f26b ; caller's pc 0xfff178ec: [top + 16] <- 0xfff17970 ; caller's fp 0xfff178e8: [top + 12] <- 0x60cae699 ; context 0xfff178e4: [top + 8] <- 0x503e4079 ; function 0xfff178e0: [top + 4] <- 0x60cae9ad ; ecx 0x60cae9ad 0xfff178dc: [top + 0] <- 0x60cadc89 ; [esp + 12] 0x60cadc89 ``` -------------------------------- ### Optimization Time Measurement in Cassowary.js Source: https://github.com/slightlyoff/cassowary.js/blob/master/perf/opt_deopt.txt This code snippet shows the time taken for a specific operation within Cassowary.js. It provides a performance metric for evaluating the efficiency of the constraint solving process. ```JavaScript time = 0.22 ``` -------------------------------- ### LinearExpression multiplyMe Optimization Source: https://github.com/slightlyoff/cassowary.js/blob/master/perf/opt_deopt.txt This log entry indicates that the `multiplyMe` function, inherited from `c.LinearExpression.c`, is being optimized. It also shows the time taken for the optimization process. ```log [optimizing: c.LinearExpression.c.inherit.multiplyMe / 601ca07d - took 0.655 ms] ``` -------------------------------- ### Constraint Addition in Cassowary.js Source: https://github.com/slightlyoff/cassowary.js/blob/master/perf/opt_deopt.txt This code snippet shows the addition of constraints to the Cassowary.js solver. It indicates the number of constraints successfully added, the number of attempted additions, and the number of exceptions encountered during the process. ```JavaScript done adding 585 constraints [5000 attempted, 0 exceptions] ``` -------------------------------- ### Optimizing LinearExpression.multiplyMe (JavaScript) Source: https://github.com/slightlyoff/cassowary.js/blob/master/perf/opt_deopt.txt This log entry indicates that the `multiplyMe` function within the `LinearExpression` class is being optimized. It also provides the time taken for the optimization process. ```JavaScript [optimizing: c.LinearExpression.c.inherit.multiplyMe / 60085641 - took 0.532 ms] ``` -------------------------------- ### LinearExpression MultiplyMe Deoptimization Source: https://github.com/slightlyoff/cassowary.js/blob/master/perf/opt_deopt.txt This log captures the deoptimization of the `c.LinearExpression.c.inherit.multiplyMe` function. It provides details about the stack layout and register values at the point of deoptimization. Analyzing this information can help determine the cause of the bailout and identify potential performance improvements for the multiplication operation. ```JavaScript **** DEOPT: c.LinearExpression.c.inherit.multiplyMe at bailout #9, address 0x0, frame size 12 [deoptimizing: begin 0x503e4109 c.LinearExpression.c.inherit.multiplyMe @9] translating c.LinearExpression.c.inherit.multiplyMe => node=14, height=4 0xfff17940: [top + 24] <- 0x608f2a89 ; eax 0x608f2a89 0xfff1793c: [top + 20] <- 0x608f21a9 ; [esp + 28] 0x608f21a9 0xfff17938: [top + 16] <- 0x3c9440bc ; caller's pc 0xfff17934: [top + 12] <- 0xfff1794c ; caller's fp 0xfff17930: [top + 8] <- 0x608f2f85 ; context 0xfff1792c: [top + 4] <- 0x503e4109 ; function 0xfff17928: [top + 0] <- 0x608f2a89 ; eax 0x608f2a89 [deoptimizing: end 0x503e4109 c.LinearExpression.c.inherit.multiplyMe => node=14, pc=0x3c943df7, state=TOS_REG, took 0.017 ms] [removing optimized code for: c.LinearExpression.c.inherit.multiplyMe] ``` -------------------------------- ### Deoptimization of insertColVar in Tableau Source: https://github.com/slightlyoff/cassowary.js/blob/master/perf/opt_deopt.txt This snippet shows the deoptimization process of the `insertColVar` function within the `Tableau` class. It includes the bailout number, address, frame size, and the state of the stack during the deoptimization. ```JavaScript **** DEOPT: c.Tableau.c.inherit.insertColVar at bailout #22, address 0x0, frame size 40 [deoptimizing: begin 0x60f308e9 c.Tableau.c.inherit.insertColVar @22] translating c.Tableau.c.inherit.insertColVar => node=22, height=4 0xfff178bc: [top + 28] <- 0x60f4213d ; [esp + 64] 0x60f4213d 0xfff178b8: [top + 24] <- 0x60f4d2c1 ; eax 0x60f4d2c1 0xfff178b4: [top + 20] <- 0x50375a4d ; [esp + 56] 0x50375a4d 0xfff178b0: [top + 16] <- 0x3c94c74f ; caller's pc 0xfff178ac: [top + 12] <- 0xfff178c8 ; caller's fp 0xfff178a8: [top + 8] <- 0x60f40595 ; context 0xfff178a4: [top + 4] <- 0x60f308e9 ; function 0xfff178a0: [top + 0] <- 0x50308091 ; literal translating c.HashTable.c.inherit.get => node=27, height=4 0xfff1789c: [top + 24] <- 0x5037597d ; edx 0x5037597d 0xfff17898: [top + 20] <- 0x60f4d2c1 ; eax 0x60f4d2c1 0xfff17894: [top + 16] <- 0x3c94cf74 ; caller's pc 0xfff17890: [top + 12] <- 0xfff178ac ; caller's fp 0xfff1788c: [top + 8] <- 0x60f080a5 ; context 0xfff17888: [top + 4] <- 0x60f30455 ; function 0xfff17884: [top + 0] <- 0x000002a2 ; ecx 337 [deoptimizing: end 0x60f30455 c.HashTable.c.inherit.get => node=27, pc=0x3c92ef9a, state=TOS_REG, took 0.022 ms] [removing optimized code for: c.Tableau.c.inherit.insertColVar] ``` -------------------------------- ### SimplexSolver setExternalVariables Optimization Source: https://github.com/slightlyoff/cassowary.js/blob/master/perf/opt_deopt.txt This log entry shows the `_fNeedsSolving` function within `setExternalVariables` of the `SimplexSolver` class being marked for recompilation because it is a small function. The ICs with typeinfo are at 55%. The subsequent line indicates that the function was optimized, and the optimization took 0.250 ms. ```log [marking c.SimplexSolver.c.inherit.setExternalVariables._fNeedsSolving 0x60a51dd8 for recompilation, reason: small function, ICs with typeinfo: 5/9 (55%)] ``` ```log [optimizing: c.SimplexSolver.c.inherit.setExternalVariables._fNeedsSolving / 60a51dd9 - took 0.250 ms] ``` -------------------------------- ### Variable value Deoptimization Source: https://github.com/slightlyoff/cassowary.js/blob/master/perf/opt_deopt.txt This snippet shows the deoptimization of the `c.Variable.c.inherit.value` function. The log provides details about the bailout point (#1), the address in memory (0x0), and the frame size (4). It also includes the state of the execution stack at the time of deoptimization, showing the values of various registers and memory locations. ```JavaScript **** DEOPT: c.Variable.c.inherit.value at bailout #1, address 0x0, frame size 4 [deoptimizing: begin 0x503e3f59 c.Variable.c.inherit.value @1] translating c.Variable.c.inherit.value => node=3, height=0 0xfff178b8: [top + 16] <- 0x2d3b47c1 ; [esp + 20] 0x2d3b47c1 0xfff178b4: [top + 12] <- 0x3c9482b0 ; caller's pc 0xfff178b0: [top + 8] <- 0xfff178d4 ; caller's fp 0xfff178ac: [top + 4] <- 0x5502a855 ; context 0xfff178a8: [top + 0] <- 0x503e3f59 ; function [deoptimizing: end 0x503e3f59 c.Variable.c.inherit.value => node=3, pc=0x3c93ef47, state=NO_REGISTERS, took 0.009 ms] ``` -------------------------------- ### Configuring Cassowary.js Debugging Options in JavaScript Source: https://github.com/slightlyoff/cassowary.js/blob/master/README.md These boolean flags control the level of debugging information logged by the Cassowary.js solver. Setting these flags to `true` enables different levels of logging, from general debugging to verbose tracing of tableau additions and garbage collection. ```JavaScript // Log general debugging information c.debug = [ false || true ]; // default false // Detailed logging c.trace = [ false || true ]; // default false // Verbose logging c.verbose = [ false || true ]; // default false // Logging of tableau additions c.traceAdded = [ false || true ]; // default false // Logging of ...? c.GC = [ false || true ]; // default false ``` -------------------------------- ### HashTable Put Deoptimization Source: https://github.com/slightlyoff/cassowary.js/blob/master/perf/opt_deopt.txt This snippet shows the deoptimization of the `put` method within the `HashTable` class. Deoptimization occurs at bailout #5, indicating a potential performance issue during hash table insertion. The stack trace provides context about the function's state at the time of deoptimization. ```JavaScript **** DEOPT: c.HashTable.c.inherit.put at bailout #5, address 0x0, frame size 16 [deoptimizing: begin 0x503d0299 c.HashTable.c.inherit.put @5] translating c.HashTable.c.inherit.put => node=14, height=12 0xfff178b4: [top + 36] <- 0x503763b1 ; [esp + 40] 0x503763b1 0xfff178b0: [top + 32] <- 0x47cb7dd9 ; eax 0x47cb7dd9 0xfff178ac: [top + 28] <- 0x60cae579 ; [esp + 32] 0x60cae579 0xfff178a8: [top + 24] <- 0x3c9550e0 ; caller's pc 0xfff178a4: [top + 20] <- 0xfff178e4 ; caller's fp 0xfff178a0: [top + 16] <- 0x503d0271 ; context 0xfff1789c: [top + 12] <- 0x503d0299 ; function 0xfff17898: [top + 8] <- 0x50308091 ; literal 0xfff17894: [top + 4] <- 0x50308091 ; literal 0xfff17890: [top + 0] <- 0x503e3881 ; [esp + 8] 0x503e3881 ``` -------------------------------- ### EditOrStayCtor Deoptimization Source: https://github.com/slightlyoff/cassowary.js/blob/master/perf/opt_deopt.txt This snippet shows the deoptimization of the `EditOrStayCtor` function. The log provides details about the bailout point (#7), the address in memory (0x0), and the frame size (24). It also includes the state of the execution stack at the time of deoptimization, showing the values of various registers and memory locations. ```JavaScript **** DEOPT: EditOrStayCtor at bailout #7, address 0x0, frame size 24 [deoptimizing: begin 0x50372f95 EditOrStayCtor @7] translating EditOrStayCtor => node=20, height=0 0xfff178e8: [top + 28] <- 0x609e8831 ; eax 0x609e8831 0xfff178e4: [top + 24] <- 0x2d3b47c1 ; [esp + 48] 0x2d3b47c1 0xfff178e0: [top + 20] <- 0x5504c8a5 ; [esp + 44] 0x5504c8a5 0xfff178dc: [top + 16] <- 0x50308091 ; [esp + 40] 0x50308091 0xfff178d8: [top + 12] <- 0x3c90db41 ; caller's pc 0xfff178d4: [top + 8] <- 0xfff178f8 ; caller's fp 0xfff178d0: [top + 4] <- 0x503d02fd ; context 0xfff178cc: [top + 0] <- 0x50372f95 ; function [deoptimizing: end 0x50372f95 EditOrStayCtor => node=20, pc=0x3c94827a, state=NO_REGISTERS, took 0.019 ms] [removing optimized code for: EditOrStayCtor] ``` -------------------------------- ### HashTable EscapingEach Deoptimization Source: https://github.com/slightlyoff/cassowary.js/blob/master/perf/opt_deopt.txt This snippet shows the deoptimization of the `escapingEach` method within the `HashTable` class. The deoptimization occurs at bailout #10. The stack trace provides context about the function's state at the time of deoptimization, including the arguments and caller information. ```JavaScript **** DEOPT: c.HashTable.c.inherit.escapingEach at bailout #10, address 0x0, frame size 16 [deoptimizing: begin 0x503e409d c.HashTable.c.inherit.escapingEach @10] translating c.HashTable.c.inherit.escapingEach => node=100, height=8 0xfff178c4: [top + 32] <- 0x60cadc89 ; [esp + 40] 0x60cadc89 0xfff178c0: [top + 28] <- 0x60cae8c1 ; [esp + 36] 0x60cae8c1 0xfff178bc: [top + 24] <- 0x5504b1fd ; [esp + 32] 0x5504b1fd 0xfff178b8: [top + 20] <- 0x3c985b88 ; caller's pc 0xfff178b4: [top + 16] <- 0xfff178ec ; caller's fp 0xfff178b0: [top + 12] <- 0x60cae8f5 ; context 0xfff178ac: [top + 8] <- 0x503e409d ; function 0xfff178a8: [top + 4] <- 0x60cadcbd ; [esp + 8] 0x60cadcbd 0xfff178a4: [top + 0] <- 0 ; [esp + 0] (smi) ``` -------------------------------- ### Recompiling AbstractVariable.hashCode Source: https://github.com/slightlyoff/cassowary.js/blob/master/perf/opt_deopt.txt This log entry indicates that the `hashCode` function within the `AbstractVariable` class is being marked for recompilation. The reason provided is that it's a small function, and its inline caches (ICs) have a high percentage of type information (100%), suggesting it's a good candidate for optimization. ```JavaScript [marking c.AbstractVariable.c.inherit.hashCode 0x503e3838 for recompilation, reason: small function, ICs with typeinfo: 1/1 (100%)] ``` ```JavaScript [optimizing: c.AbstractVariable.c.inherit.hashCode / 503e3839 - took 0.055 ms] ``` -------------------------------- ### Expression's substituteOut Method Source: https://github.com/slightlyoff/cassowary.js/blob/master/redesign_notes.md The `substituteOut` method of the `c.Expression` class substitutes a variable within the expression with another expression. It requires a solver to handle variable removal and addition during the substitution process. ```javascript c.Expression = c.inherit({ // ... substituteOut: function(outvar /*c.AbstractVariable*/, expr /*c.Expression*/, subject /*c.AbstractVariable*/, solver /*ClTableau*/) { if (!solver) { throw new c.InternalError("substituteOut called without a solver"); } var setVariable = this.setVariable.bind(this); var terms = this.terms; var multiplier = terms.get(outvar); terms.delete(outvar); this.constant += (multiplier * expr.constant); expr.terms.each(function(clv, coeff) { var oldCoefficient = terms.get(clv); if (oldCoefficient) { var newCoefficient = oldCoefficient + multiplier * coeff; if (c.approx(newCoefficient, 0)) { solver.noteRemovedVariable(clv, subject); terms.delete(clv); } else { setVariable(clv, newCoefficient); } } else { setVariable(clv, multiplier * coeff); if (solver) { solver.noteAddedVariable(clv, subject); } } }); }, // ... }); ``` -------------------------------- ### Time Taken for an Operation (JavaScript) Source: https://github.com/slightlyoff/cassowary.js/blob/master/perf/opt_deopt.txt This log entry indicates the time taken for a specific operation. In this case, the time is 0.301 units (likely milliseconds or seconds, depending on the context). This information is useful for performance analysis and identifying potential bottlenecks. ```JavaScript time = 0.301 ``` -------------------------------- ### Marking SimplexSolver.setExternalVariables._fNeedsSolving for Recompilation (Cassowary.js) Source: https://github.com/slightlyoff/cassowary.js/blob/master/perf/opt_deopt.txt This log entry indicates that the '_fNeedsSolving' function within the 'SimplexSolver.setExternalVariables' is being marked for recompilation. The reason provided is that it's a small function, and the inline cache (IC) information shows a percentage of type information hits (55%). ```JavaScript [marking c.SimplexSolver.c.inherit.setExternalVariables._fNeedsSolving 0x603f7c48 for recompilation, reason: small function, ICs with typeinfo: 5/9 (55%)] ``` -------------------------------- ### Deoptimization Information for addVariable Function Source: https://github.com/slightlyoff/cassowary.js/blob/master/perf/opt_deopt.txt This snippet provides detailed information about the deoptimization of the c.LinearExpression.c.inherit.addVariable function, including the bailout number, address, frame size, and stack trace. The stack trace shows the values of various registers and memory locations at the point of deoptimization, which can be useful for debugging. ```JavaScript [deoptimizing: begin 0x503e3fc5 c.LinearExpression.c.inherit.addVariable @24] translating c.LinearExpression.c.inherit.addVariable => node=64, height=12 0xfff17884: [top + 44] <- 0x60ac914d ; [esp + 96] 0x60ac914d 0xfff17880: [top + 40] <- 0x47c2c309 ; [esp + 92] 0x47c2c309 0xfff1787c: [top + 36] <- 0x60acb2c9 ; [esp + 56] 0x60acb2c9 0xfff17878: [top + 32] <- 0x50308091 ; [esp + 84] 0x50308091 0xfff17874: [top + 28] <- 0x50308091 ; [esp + 80] 0x50308091 0xfff17870: [top + 24] <- 0x3c944abe ; caller's pc 0xfff1786c: [top + 20] <- 0xfff17890 ; caller's fp 0xfff17868: [top + 16] <- 0x503d02e1 ; context 0xfff17864: [top + 12] <- 0x503e3fc5 ; function 0xfff17860: [top + 8] <- 0x50308091 ; literal 0xfff1785c: [top + 4] <- 0x50308091 ; literal 0xfff17858: [top + 0] <- 0x50308081 ; literal [deoptimizing: end 0x503e3fc5 c.LinearExpression.c.inherit.addVariable => node=64, pc=0x3c944e93, state=TOS_REG, took 0.024 ms] ``` -------------------------------- ### Marking c.LinearExpression.c.inherit.multiplyMe for recompilation Source: https://github.com/slightlyoff/cassowary.js/blob/master/perf/opt_deopt.txt This log entry indicates that the 'multiplyMe' function within the 'c.LinearExpression.c.inherit' namespace is being marked for recompilation. The reason provided is that the function is small and has inline caches (ICs) with type information. The ICs with typeinfo ratio is 100%, suggesting that the function's type information is well-defined. ```JavaScript c.LinearExpression.c.inherit.multiplyMe ``` -------------------------------- ### Marking LinearExpression.multiplyMe for Recompilation Source: https://github.com/slightlyoff/cassowary.js/blob/master/perf/opt_deopt.txt This log entry indicates that the `multiplyMe` function within the `LinearExpression` class is being marked for recompilation. The reason provided is that it's a small function, and the ICs with typeinfo are at 100%. ```JavaScript c.LinearExpression.c.inherit.multiplyMe ``` -------------------------------- ### SimplexSolver setExternalVariables Recompilation Source: https://github.com/slightlyoff/cassowary.js/blob/master/perf/opt_deopt.txt This snippet shows the recompilation and optimization of the `setExternalVariables._fNeedsSolving` method within the `SimplexSolver` class. The reason provided is that the function is considered a 'small function' with a moderate percentage of ICs having type information. This suggests that the function is frequently called and its input types are somewhat predictable, making it a candidate for optimization. ```JavaScript [marking c.SimplexSolver.c.inherit.setExternalVariables._fNeedsSolving 0x609e53f0 for recompilation, reason: small function, ICs with typeinfo: 5/9 (55%)] [optimizing: c.SimplexSolver.c.inherit.setExternalVariables._fNeedsSolving / 609e53f1 - took 0.261 ms] ``` -------------------------------- ### Linear Expression Multiply Me Recompilation Source: https://github.com/slightlyoff/cassowary.js/blob/master/perf/opt_deopt.txt This snippet shows the recompilation and optimization of the `multiplyMe` method within the `LinearExpression` class. The recompilation is triggered due to the function's small size and the presence of inline caches with complete type information. ```JavaScript c.LinearExpression.c.inherit.multiplyMe ```