Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat/use inp #7

Merged
merged 6 commits into from Jun 10, 2022
Merged

Feat/use inp #7

merged 6 commits into from Jun 10, 2022

Conversation

keiya01
Copy link
Contributor

@keiya01 keiya01 commented Jun 3, 2022

INP(Interaction to Next Paint)の計測スクリプトを追加しました。

INPはFIDを拡張したもので、click, keypressなどのeventが発生してから次のpaint処理が走るまでの時間を計測します。
ユーザーのインタラクションから次のframeが表示されるまでに以下のように時間が計測されます。

  • The input delay, which is the time between when the user interacts with the page, and when event handlers execute.
  • The processing time, which is the total amount of time it takes to execute code in associated event handlers.
  • The presentation delay, which is the time between when event handlers have finished executing, and when the browser presents the next frame.

指標は以下のようになっています。

Good Needs Improvement Poor
~ 200ms 200ms ~ 500ms 500ms ~

web-vitalsライブラリではINPに閾値を設定できて、defaultでは40ms以下はデータを取得しないようになっています。

詳細は https://web.dev/inp/ を確認してください。

INPはまだexperimentalな仕様なので今後変わる可能性があります。
そのためstableリリースではなく、npm version prerelease --preid=betaとしてリリースします。

@keiya01 keiya01 changed the base branch from main to beta June 3, 2022 04:22
@@ -4,8 +4,10 @@ import {
getFID,
getLCP,
getTTFB,
onINP,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

INP以外も on* にしておいた方が良かったりするかな!?
https://github.com/GoogleChrome/web-vitals/tree/next

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

これまだnextなので悩み中ですw
stableに入ってからでも良いかなと思ったりしてます

Copy link
Member

@herablog herablog Jun 9, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

今読み込んでる3.0.0-beta.2nextと同等 (versionsタブを参照)なのでbetaとして出すなら揃えちゃっていいかもなぁ。

まあどっちでも読んでも中身は一緒なんですがw
https://github.com/GoogleChrome/web-vitals/blob/next/src/deprecated.ts

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

f1175e0
揃えました!

Copy link
Member

@herablog herablog left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

エンジニアを褒めるネコ:仕事はやい

@keiya01 keiya01 merged commit d2bbcc7 into beta Jun 10, 2022
@keiya01 keiya01 deleted the feat/use-inp branch June 10, 2022 06:44
@keiya01 keiya01 mentioned this pull request Jun 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants