(n, cols = 12)
| 43 | |
| 44 | // Generate a messy (uncompacted) layout |
| 45 | function generateMessyLayout(n, cols = 12) { |
| 46 | const layout = []; |
| 47 | for (let i = 0; i < n; i++) { |
| 48 | layout.push({ |
| 49 | i: String(i), |
| 50 | x: Math.floor(Math.random() * (cols - 2)), |
| 51 | y: Math.floor(Math.random() * (n / 2)), |
| 52 | w: 1 + Math.floor(Math.random() * 3), |
| 53 | h: 1 + Math.floor(Math.random() * 3) |
| 54 | }); |
| 55 | } |
| 56 | return layout; |
| 57 | } |
| 58 | |
| 59 | // Measure execution time of a function |
| 60 | function measureTime(fn, iterations = 100) { |
no outgoing calls
no test coverage detected
searching dependent graphs…