[Regression]: evaluate() with larger results ~40% slower since 1.65
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 初心者へのやさしさ
- 62/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
- 技術スタック
- python
- 領域
- performance
調査の方向性
Start in protocol/validator_primitives.py, reading t_object and the t_optional helper, and trace where SerializedValue's schema keys are iterated. Before editing, run the issue's page.evaluate benchmark script to record a baseline, then re-run it after skipping the optional-key validators when a key is absent. Also run the protocol validator tests in tests/ (the suite that round-trips validated messages) to confirm malformed messages are still rejected. Done means the benchmark is back near 1.30s with unchanged validation behaviour, including for events and initializers.
索引モデルが issue の本文から書いたものです。
説明
Last Good Version
1.64.0
First Bad Version
1.65.0
Steps to reproduce
evaluate() with a medium-sized result got about 40% slower:
import time
from playwright.sync_api import sync_playwright
JS = "Array.from({length: 200}, (_, i) => ({id: i, name: 'item ' + i, price: i * 1.5, url: 'https://example.com/' + i, tags: ['a', 'b']}))"
with sync_playwright() as p:
page = p.chromium.launch().new_page()
page.evaluate(JS)
best = 1e9
for _ in range(3):
start = time.perf_counter()
for _ in range(300):
page.evaluate(JS)
best = min(best, time.perf_counter() - start)
print(f"{best:.2f}s")
Expected behavior
1.64.0: 1.30s
Actual behavior
1.65.2: 1.84s
Additional context
cProfile points at the protocol validator: the t_object validator in protocol/validator_primitives.py is about 60% of the profiled time. For every object node it calls the validator of every key in the schema, and SerializedValue has ~15 optional keys, so most calls are t_optional(None) for keys that aren't there. It also calls context.is_under_test() once per node.
Skipping the call when the key is absent and the validator is a t_optional (the result is None in that case anyway) brings the script above to 1.47s in my test, same output. Validated messages also include every event and initializer, so it's not only evaluate.
Environment
- Operating System: macOS 27.2
- CPU: arm64
- Browser: Chromium
- Python Version: 3.14
- Other info:
- 主要言語
- Python
- スター
- 15.1k
- フォーク
- 1.3k
- 平均マージ
- 6時間 16分
- マージ済み PR(30日)
- 53
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
microsoft/playwright-python のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
microsoft/playwright-python#3361 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
microsoft/playwright-python#3360 ·
メンテナーはふだん 1 日以内に返信
microsoft/playwright-python の issue をすべて見る
似ている issue
-
難易度 1/5 1時間未満 初心者へのやさしさ 88/100
snap-stanford/Biomni#380 ·
-
documentation priority: low size: S status: needs triage
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
cubrid-lab/sqlalchemy-cubrid#1397 ·
メンテナーはふだん 1 日以内に返信
-
documentation priority: low size: S status: needs triage
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
cubrid-lab/pycubrid#1307 ·
メンテナーはふだん 1 日以内に返信
-
[Bug]: Installer hides SSL certificate errors as bare URLError, and the suggested fix can't workオープンbug
難易度 2/5 1〜3時間 初心者へのやさしさ 80/100
ShaftHQ/chaosengine-harness#143 ·
メンテナーはふだん 1 日以内に返信
-
bug high-severity
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
aws/bedrock-agentcore-sdk-python#752 ·
メンテナーはふだん 1 日以内に返信