Skip to content

Commit cc0de82

Browse files
committed
Translate Profiler
1 parent a5fe204 commit cc0de82

File tree

1 file changed

+35
-35
lines changed

1 file changed

+35
-35
lines changed

content/docs/reference-profiler.md

Lines changed: 35 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,27 @@
11
---
22
id: profiler
3-
title: Profiler API
3+
title: プロファイラ API
44
layout: docs
55
category: Reference
66
permalink: docs/profiler.html
77
---
88

9-
The `Profiler` measures how often a React application renders and what the "cost" of rendering is.
10-
Its purpose is to help identify parts of an application that are slow and may benefit from [optimizations such as memoization](https://reactjs.org/docs/hooks-faq.html#how-to-memoize-calculations).
9+
`Profiler` を使って、React アプリケーションのレンダーの頻度やレンダーの「コスト」を計測することができます。
10+
本機能の目的は、アプリケーション中の、低速で[メモ化などの最適化](https://reactjs.org/docs/hooks-faq.html#how-to-memoize-calculations)が有効な可能性のある部位を特定する手助けをすることです。
1111

12-
> Note:
12+
> 補足:
1313
>
14-
> Profiling adds some additional overhead, so **it is disabled in [the production build](https://reactjs.org/docs/optimizing-performance.html#use-the-production-build)**.
14+
> プロファイリングによる追加のオーバーヘッドが生じますので、**[本番ビルド](https://reactjs.org/docs/optimizing-performance.html#use-the-production-build)では無効化されます**.
1515
>
16-
> To opt into production profiling, React provides a special production build with profiling enabled.
17-
> Read more about how to use this build at [fb.me/react-profiling](https://fb.me/react-profiling)
16+
> 本番環境でプロファイリングを利用するために、React はプロファイリングを有効化した特別な本番用ビルドを提供しています。
17+
> このビルドの使用方法については [fb.me/react-profiling](https://fb.me/react-profiling) をご覧ください。
1818
19-
## Usage {#usage}
19+
## 使用法 {#usage}
2020

21-
A `Profiler` can be added anywhere in a React tree to measure the cost of rendering that part of the tree.
22-
It requires two props: an `id` (string) and an `onRender` callback (function) which React calls any time a component within the tree "commits" an update.
21+
`Profiler` React ツリー内の特定部位におけるレンダーのコストを計測するため、ツリー内のどこにでも追加できます。
22+
2 つの props が必要です。`id`(文字列)と、ツリー内のコンポーネントが更新を「コミット」した際に React が毎回呼び出す `onRender` コールバック(関数)です。
2323

24-
For example, to profile a `Navigation` component and its descendants:
24+
例えば、`Navigation` コンポーネントとその子孫のプロファイリングを行うには:
2525

2626
```js{3}
2727
render(
@@ -34,7 +34,7 @@ render(
3434
);
3535
```
3636

37-
Multiple `Profiler` components can be used to measure different parts of an application:
37+
アプリケーション内の複数部位の計測を行うために複数の `Profiler` コンポーネントを使うことができます:
3838
```js{3,6}
3939
render(
4040
<App>
@@ -48,7 +48,7 @@ render(
4848
);
4949
```
5050

51-
`Profiler` components can also be nested to measure different components within the same subtree:
51+
同一のサブツリー内の複数のコンポーネントで計測を行うために `Profiler` コンポーネントをネストすることもできます:
5252
```js{2,6,8}
5353
render(
5454
<App>
@@ -66,15 +66,15 @@ render(
6666
);
6767
```
6868

69-
> Note
69+
> 補足
7070
>
71-
> Although `Profiler` is a light-weight component, it should be used only when necessary; each use adds some CPU and memory overhead to an application.
71+
> `Profiler` は軽いコンポーネントですが、必要な時にのみ利用すべきです。使うごとにアプリケーションに多少の CPU およびメモリオーバーヘッドが生じます。
7272
73-
## `onRender` Callback {#onrender-callback}
73+
## `onRender` コールバック {#onrender-callback}
7474

75-
The `Profiler` requires an `onRender` function as a prop.
76-
React calls this function any time a component within the profiled tree "commits" an update.
77-
It receives parameters describing what was rendered and how long it took.
75+
`Profiler` には props として `onRender` 関数を渡す必要があります。
76+
プロファイリングされているツリー内のコンポーネントが更新を「コミット」した際に、Raect がこの関数を毎回呼び出します。
77+
この関数は、レンダー内容とかかった時間に関する情報を引数として受け取ります。
7878

7979
```js
8080
function onRenderCallback(
@@ -90,30 +90,30 @@ function onRenderCallback(
9090
}
9191
```
9292

93-
Let's take a closer look at each of the props:
93+
それぞれを詳細に見てみましょう:
9494

9595
* **`id: string`** -
96-
The `id` prop of the `Profiler` tree that has just committed.
97-
This can be used to identify which part of the tree was committed if you are using multiple profilers.
96+
コミットが起きた `Profiler``id` プロパティ。
97+
複数のプロファイラを使用している場合にどのツリーにコミットが起きたのかを区別するのに使うことができます。
9898
* **`phase: "mount" | "update"`** -
99-
Identifies whether the tree has just been mounted for the first time or re-rendered due to a change in props, state, or hooks.
99+
ツリーが初回マウントされたのか、props や state、フックの変更によって再レンダーされたのかを区別します。
100100
* **`actualDuration: number`** -
101-
Time spent rendering the `Profiler` and its descendants for the current update.
102-
This indicates how well the subtree makes use of memoization (e.g. [`React.memo`](/docs/react-api.html#reactmemo), [`useMemo`](/docs/hooks-reference.html#usememo), [`shouldComponentUpdate`](/docs/hooks-faq.html#how-do-i-implement-shouldcomponentupdate)).
103-
Ideally this value should decrease significantly after the initial mount as many of the descendants will only need to re-render if their specific props change.
101+
現在の更新で `Profiler` とその子孫のレンダーに要した時間。
102+
これが([`React.memo`](/docs/react-api.html#reactmemo)[`useMemo`](/docs/hooks-reference.html#usememo)[`shouldComponentUpdate`](/docs/hooks-faq.html#how-do-i-implement-shouldcomponentupdate))などの)メモ化をどれだけうまく有効に使えているかの指標となります。
103+
理想的には、子孫要素は特定の props が変化した場合にのみ再レンダーされるため、初回マウント時以降にこの値は大幅に小さくなるはずです。
104104
* **`baseDuration: number`** -
105-
Duration of the most recent `render` time for each individual component within the `Profiler` tree.
106-
This value estimates a worst-case cost of rendering (e.g. the initial mount or a tree with no memoization).
105+
`Profiler` ツリー内のそれぞれのコンポーネントの直近の `render` 時間。
106+
この値を使って最悪の場合のレンダーコスト(初回マウント時や、メモ化の一切ないツリーの場合)を見積もることができます。
107107
* **`startTime: number`** -
108-
Timestamp when React began rendering the current update.
108+
現在の更新のレンダーを React が開始した時刻に対応するタイムスタンプ。
109109
* **`commitTime: number`** -
110-
Timestamp when React committed the current update.
111-
This value is shared between all profilers in a commit, enabling them to be grouped if desirable.
110+
現在の更新を React がコミットした時刻に対応するタイムスタンプ。
111+
必要に応じてグループ化できるよう、1 コミット内のすべてのプロファイラ間でこの値は共有されます。
112112
* **`interactions: Set`** -
113-
Set of ["interactions"](http://fb.me/react-interaction-tracing) that were being traced the update was scheduled (e.g. when `render` or `setState` were called).
113+
更新がスケジュールされた(`render``setState` の呼び出しなどにより)際に trace された ["interaction"](http://fb.me/react-interaction-tracing) の Set。
114114

115-
> Note
115+
> 補足
116116
>
117-
> Interactions can be used to identify the cause of an update, although the API for tracing them is still experimental.
117+
> 更新の原因を特定するために interaction を利用可能ですが、trace 用の API は依然実験的です。
118118
>
119-
> Learn more about it at [fb.me/react-interaction-tracing](http://fb.me/react-interaction-tracing)
119+
> [fb.me/react-interaction-tracing](http://fb.me/react-interaction-tracing) に詳細があります。

0 commit comments

Comments
 (0)