Andrey Epifancev 627ea82321 perf: замеры открытия модалок
Перечень модалок (modals.json), measureOpen с main_thread_ms, профиль
перерисовок React (reactProfile), сценарий modals.spec.ts, подкоманда
stand.sh web-profiling (:8081), генератор modals-inventory.md.

Refs #202

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-26 00:53:55 +04:00

31 lines
1.5 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!doctype html>
<meta charset="utf-8">
<title>modal</title>
<button id="open">open</button>
<button id="open-busy">open busy</button>
<button id="open-plain">open plain div</button>
<button id="nothing">nothing</button>
<script>
const busy = (ms) => { const t = performance.now(); while (performance.now() - t < ms) {} };
const dialog = () => {
const d = document.createElement('div');
d.setAttribute('role', 'dialog');
d.style.cssText = 'position:fixed;left:50px;top:50px;width:200px;height:100px;background:#eee';
d.textContent = 'dialog';
document.body.appendChild(d);
};
// 150 мс до появления role=dialog
document.getElementById('open').addEventListener('click', () => setTimeout(dialog, 150));
// 90 мс синхронной работы (long task) + 150 мс до появления
document.getElementById('open-busy').addEventListener('click', () => { busy(90); setTimeout(dialog, 150); });
// модалка без role (как common/Modal приложения): div.fixed с заголовком
document.getElementById('open-plain').addEventListener('click', () => setTimeout(() => {
const d = document.createElement('div');
d.className = 'plain-modal';
d.style.cssText = 'position:fixed;left:50px;top:50px;width:200px;height:100px;background:#eee';
d.innerHTML = '<h2>Заголовок модалки</h2>';
document.body.appendChild(d);
}, 150));
document.getElementById('nothing').addEventListener('click', () => {});
</script>