Skip to content

Commit

Permalink
Minor optimizations
Browse files Browse the repository at this point in the history
  • Loading branch information
raveren committed Jul 28, 2023
1 parent a75a9ca commit 489e83c
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 14 deletions.
2 changes: 1 addition & 1 deletion decorators/SageDecoratorsPlain.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public static function decorate(SageVariableData $varData, $level = 0)

public static function decorateTrace($traceData, $pathsOnly = false)
{
// if we're dealing with a framework stack, lets verbosely display last few steps only, and not hang the browser
// if we're dealing with a framework stack, lets verbosely display final few steps only, and not hang the browser
$optimizeOutput = count($traceData) >= 10 && Sage::$maxLevels !== false;
$maxLevels = Sage::$maxLevels;

Expand Down
2 changes: 1 addition & 1 deletion resources/compiled/sage.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

23 changes: 11 additions & 12 deletions resources/js/base.js
Original file line number Diff line number Diff line change
Expand Up @@ -400,22 +400,21 @@ if (typeof _sageInitialized === 'undefined') {
}
};

window.addEventListener("load", function (e) { // colorize microtime results relative to others
window.addEventListener("load", function () { // colorize microtime results relative to others
const elements = Array.prototype.slice.call(document.querySelectorAll('._sage-microtime'), 0);
elements.forEach(function (el) {
const value = parseFloat(el.innerHTML)
let min = Infinity
, max = -Infinity
, ratio;
let min = Infinity
, max = -Infinity;

elements.forEach(function (el) {
const val = parseFloat(el.innerHTML);
elements.forEach(function (el) {
const val = parseFloat(el.innerHTML);

if (min > val) min = val;
if (max < val) max = val;
});
if (min > val) min = val;
if (max < val) max = val;
});

ratio = 1 - (value - min) / (max - min);
elements.forEach(function (el) {
const val = parseFloat(el.innerHTML);
const ratio = 1 - (val - min) / (max - min);

el.style.background = 'hsl(' + Math.round(ratio * 120) + ',60%,70%)';
});
Expand Down
Binary file modified sage.phar
Binary file not shown.

0 comments on commit 489e83c

Please sign in to comment.