Profile mobile chat text rendering
This commit is contained in:
@@ -23,6 +23,10 @@ String _answer(int index) =>
|
||||
'```dart\n'
|
||||
'${List.generate(30, (line) => 'final v$line = $index * $line;').join('\n')}'
|
||||
'\n```\n\n'
|
||||
'| check | result | owner |\n'
|
||||
'| --- | --- | --- |\n'
|
||||
'| unit tests | passed | worker $index |\n'
|
||||
'| static analysis | passed | worker $index |\n\n'
|
||||
'- one\n- two\n- three\n';
|
||||
|
||||
/// The fixture history; the newest message is the operator's, so a streamed
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
// flutter build web --release --target tool/chat_composer_probe_entry.dart \
|
||||
// --output build/chat-perf
|
||||
// then:
|
||||
// node tool/chat_perf_probe.mjs build/chat-perf [messages=300] [deltas=200]
|
||||
// node tool/chat_perf_probe.mjs build/chat-perf [messages=300] [deltas=200] [repeats=3]
|
||||
//
|
||||
// Three phases, each on a fresh page: open the transcript (the frames that do
|
||||
// work after the history reply), wheel-scroll it up and back down,
|
||||
@@ -17,13 +17,14 @@ import { openBrowser } from './capture/browser.mjs';
|
||||
import { flutterPage } from './capture/page.mjs';
|
||||
import { serveBuild } from './capture/serve.mjs';
|
||||
|
||||
const [dir, messagesArg = '300', deltasArg = '200'] = process.argv.slice(2);
|
||||
const [dir, messagesArg = '300', deltasArg = '200', repeatsArg = '3'] = process.argv.slice(2);
|
||||
if (!dir) {
|
||||
console.error('usage: node tool/chat_perf_probe.mjs <build dir> [messages] [deltas]');
|
||||
process.exit(2);
|
||||
}
|
||||
const messages = Number(messagesArg);
|
||||
const deltas = Number(deltasArg);
|
||||
const repeats = Number(repeatsArg);
|
||||
|
||||
function stats(frames) {
|
||||
const pick = (i) => frames.map((f) => f[i]).sort((a, b) => a - b);
|
||||
@@ -67,7 +68,7 @@ async function phase(origin, query, drive) {
|
||||
});
|
||||
const opened = Date.now();
|
||||
try {
|
||||
await page.open(`${origin}/?${query}`, { width: 880, height: 1000 });
|
||||
await page.open(`${origin}/?${query}`, { width: 560, height: 1000 });
|
||||
} catch (error) {
|
||||
throw new Error(`${error.message}; page errors: ${JSON.stringify(page.errors.slice(0, 5))}`);
|
||||
}
|
||||
@@ -89,6 +90,8 @@ async function phase(origin, query, drive) {
|
||||
|
||||
const server = await serveBuild(dir);
|
||||
try {
|
||||
const results = [];
|
||||
for (let repeat = 0; repeat < repeats; repeat++) {
|
||||
const open = await phase(server.origin, `perf=${messages}`, async ({ opened }) => {
|
||||
// The fixture flushes the timings 2.5 s after the history reply.
|
||||
const end = Date.now() + 20000;
|
||||
@@ -124,7 +127,10 @@ try {
|
||||
return { streamed: marks.includes('PERF_STREAM_END'), stream: stats(stop()) };
|
||||
},
|
||||
);
|
||||
console.log(JSON.stringify({ build: dir, messages, deltas, open, scroll, stream }, null, 2));
|
||||
results.push({ repeat: repeat + 1, open, scroll, stream });
|
||||
console.log(JSON.stringify({ repeat: repeat + 1, messages, deltas, open, scroll, stream }));
|
||||
}
|
||||
console.log(JSON.stringify({ build: dir, messages, deltas, repeats, results }, null, 2));
|
||||
} finally {
|
||||
await server.close();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user