Users demand fast, seamless webpage experiences, yet developers often struggle to meet these expectations within tight constraints. Performance optimization, while critical, is a time-consuming and often manual process. One of the most complex tasks in this domain is modifying the Document Object Model (DOM), which is why this study focuses on it. Recent advances in Large Language Models (LLMs) offer a promising avenue to automate this complex task, potentially transforming how developers address web performance issues. This study evaluates the effectiveness of nine state-of-the-art LLMs for automated web performance issue resolution. For this purpose, we first extracted the DOM trees of 15 popular webpages (e.g., Facebook), and then we used Lighthouse to retrieve their performance audit reports. Subsequently, we passed the extracted DOM trees and corresponding audits to each model for resolution. Our study considers 7 unique audit categories, revealing that LLMs universally excel at SEO & Accessibility issues. However, their efficacy in performance-critical DOM manipulations is mixed. While high-performing models like GPT-4.1 delivered significant reductions in areas like Initial Load, Interactivity, and Network Optimization (e.g., 46.52% to 48.68% audit incidence reductions), others, such as GPT-4o-mini, notably underperformed, consistently. A further analysis of these modifications showed a predominant additive strategy and frequent positional changes, alongside regressions particularly impacting Visual Stability.
翻译:用户对快速、无缝的网页体验有着强烈需求,然而开发人员往往在严格约束下难以满足这些期望。性能优化虽然至关重要,却是一个耗时且通常依赖人工的过程。该领域最复杂的任务之一是修改文档对象模型(DOM),这正是本研究聚焦于此的原因。大型语言模型(LLM)的最新进展为自动化这一复杂任务提供了前景广阔的途径,可能彻底改变开发人员处理网页性能问题的方式。本研究评估了九种前沿LLM在自动化网页性能问题解析中的有效性。为此,我们首先提取了15个热门网页(如Facebook)的DOM树,随后使用Lighthouse获取其性能审计报告。接着,我们将提取的DOM树及对应审计报告输入各模型进行解析。本研究涵盖7个独立的审计类别,结果表明LLM普遍在SEO与可访问性问题处理上表现优异。然而,其在关键性能相关的DOM操作方面效果参差不齐。虽然高性能模型如GPT-4.1在初始加载、交互性和网络优化等领域实现了显著改进(例如审计问题发生率降低46.52%至48.68%),但其他模型如GPT-4o-mini则持续表现欠佳。对这些修改的进一步分析显示,模型主要采用添加性策略及频繁的位置调整,同时存在尤其影响视觉稳定性的性能回退现象。