Merge pull request #29301 from overleaf/em-fast-png-copy-metrics

More precise metrics on fast PNG copy

GitOrigin-RevId: 8b3a65a8a70152f1743c45f701448dc97be7ffeb
This commit is contained in:
Eric Mc Sween
2025-10-28 09:05:23 +00:00
committed by Copybot
parent 618f79d4cf
commit 61d823f946
+18 -4
View File
@@ -104,11 +104,20 @@ const LATEX_MK_METRICS_STDERR = [
[
'latexmk-img-times',
s => {
const pngCategoriesByFile = new Map()
const pngCopyMatches = s.matchAll(/^PNG copy: (.*)$/gm)
const pngCopyFiles = new Set()
for (const match of pngCopyMatches) {
const filename = match[1]
pngCopyFiles.add(filename)
pngCategoriesByFile.set(filename, 'fast-copy')
}
const pngCopySkipMatches = s.matchAll(
/^PNG copy skipped \((alpha|gamma|palette|interlaced)\): (.*)$/gm
)
for (const match of pngCopySkipMatches) {
const category = match[1]
const filename = match[2]
pngCategoriesByFile.set(filename, category)
}
const timingMatches = s.matchAll(
@@ -119,9 +128,14 @@ const LATEX_MK_METRICS_STDERR = [
let type = match[1]
const timeMs = parseInt(match[2], 10)
const filename = match[3]
if (type === 'PNG' && pngCopyFiles.has(filename)) {
type = 'PNG-fast-copy'
if (type === 'PNG') {
const pngCategory = pngCategoriesByFile.get(filename)
if (pngCategory != null) {
type = `PNG-${pngCategory}`
}
}
const accumulatedTime = timingsByType.get(type) ?? 0
timingsByType.set(type, accumulatedTime + timeMs)
}