Skip to content

Commit 2e269a0

Browse files
authored
Merge pull request #629 from reactjs/tr/Profiler
Translate "<Profiler>"
2 parents 80ba2c8 + 1915bdf commit 2e269a0

File tree

1 file changed

+27
-27
lines changed

1 file changed

+27
-27
lines changed

src/content/reference/react/Profiler.md

+27-27
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ title: <Profiler>
44

55
<Intro>
66

7-
`<Profiler>` lets you measure rendering performance of a React tree programmatically.
7+
`<Profiler>` を使うことで、React ツリーのレンダリングパフォーマンスをプログラムで測定することができます。
88

99
```js
1010
<Profiler id="App" onRender={onRender}>
@@ -18,55 +18,55 @@ title: <Profiler>
1818

1919
---
2020

21-
## Reference {/*reference*/}
21+
## リファレンス {/*reference*/}
2222

2323
### `<Profiler>` {/*profiler*/}
2424

25-
Wrap a component tree in a `<Profiler>` to measure its rendering performance.
25+
コンポーネントツリーを `<Profiler>` でラップすることで、レンダーのパフォーマンスを測定することができます。
2626

2727
```js
2828
<Profiler id="App" onRender={onRender}>
2929
<App />
3030
</Profiler>
3131
```
3232

33-
#### Props {/*props*/}
33+
#### props {/*props*/}
3434

35-
* `id`: A string identifying the part of the UI you are measuring.
36-
* `onRender`: An [`onRender` callback](#onrender-callback) that React calls every time components within the profiled tree update. It receives information about what was rendered and how much time it took.
35+
* `id`: UI のどの部分を測定対象としているのか識別するための文字列です。
36+
* `onRender`: プロファイリング対象のツリー内のコンポーネントが更新されるたびに React が呼び出す [`onRender` コールバック](#onrender-callback)。何がレンダーされ、それにどれだけの時間がかかったかについての情報を受け取ります。
3737

38-
#### Caveats {/*caveats*/}
38+
#### 注意点 {/*caveats*/}
3939

40-
* Profiling adds some additional overhead, so **it is disabled in the production build by default.** To opt into production profiling, you need to enable a [special production build with profiling enabled.](https://fb.me/react-profiling)
40+
* プロファイリングには追加のオーバーヘッドが発生するため、**デフォルトでは本番用ビルドでは無効になっています**。本番環境でプロファイリングを行うためには、[プロファイリングを有効にしたな特別な本番用ビルド](https://fb.me/react-profiling)を明示的に用いる必要があります。
4141

4242
---
4343

44-
### `onRender` callback {/*onrender-callback*/}
44+
### `onRender` コールバック {/*onrender-callback*/}
4545

46-
React will call your `onRender` callback with information about what was rendered.
46+
React `onRender` コールバックを呼び出して、何がレンダーされたかについての情報を伝えます。
4747

4848
```js
4949
function onRender(id, phase, actualDuration, baseDuration, startTime, commitTime) {
5050
// Aggregate or log render timings...
5151
}
5252
```
5353

54-
#### Parameters {/*onrender-parameters*/}
54+
#### 引数 {/*onrender-parameters*/}
5555

56-
* `id`: The string `id` prop of the `<Profiler>` tree that has just committed. This lets you identify which part of the tree was committed if you are using multiple profilers.
57-
* `phase`: `"mount"`, `"update"` or `"nested-update"`. This lets you know whether the tree has just been mounted for the first time or re-rendered due to a change in props, state, or hooks.
58-
* `actualDuration`: The number of milliseconds spent rendering the `<Profiler>` and its descendants for the current update. This indicates how well the subtree makes use of memoization (e.g. [`memo`](/reference/react/memo) and [`useMemo`](/reference/react/useMemo)). 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.
59-
* `baseDuration`: The number of milliseconds estimating how much time it would take to re-render the entire `<Profiler>` subtree without any optimizations. It is calculated by summing up the most recent render durations of each component in the tree. This value estimates a worst-case cost of rendering (e.g. the initial mount or a tree with no memoization). Compare `actualDuration` against it to see if memoization is working.
60-
* `startTime`: A numeric timestamp for when React began rendering the current update.
61-
* `endTime`: A numeric timestamp for when React committed the current update. This value is shared between all profilers in a commit, enabling them to be grouped if desirable.
56+
* `id`: たった今コミットされたツリーに対応する `<Profiler>` `id` プロパティ。複数のプロファイラを使用している場合に、どのツリーがコミットされたかをこれにより識別できます。
57+
* `phase`: `"mount"``"update"`、または `"nested-update"`。これにより、ツリーが初めてマウントされたのか、propsstate、またはフックの変更により再レンダーされたのかを知ることができます。
58+
* `actualDuration`: 現在の更新のために `<Profiler>` とその子要素がレンダーに費やしたミリ秒数。これは、サブツリーがメモ化(例:[`memo`](/reference/react/memo) [`useMemo`](/reference/react/useMemo))をどれだけうまく利用できているかを示すものです。理想的には、子要素の多くが自身の props が変更された場合にのみ再レンダーされるようになることで、この値は初回マウント後に大幅に減少していくはずです。
59+
* `baseDuration`: もし最適化なしで `<Profiler>` サブツリー全体を再レンダーした場合にかかる時間をミリ秒で推定した数値。ツリー内の各コンポーネントの最後のレンダーにかかった時間を合計することで計算されます。この値は、最悪のツリーのレンダーコスト(例:初回マウントやメモ化がない場合)を推定します。メモ化が機能しているかどうかを確認するには、この値を `actualDuration` と比較します。
60+
* `startTime`: React が現在の更新のレンダーを開始した時刻のタイムスタンプ。
61+
* `endTime`: React が現在の更新をコミットした時刻のタイムスタンプ。この値は単一コミット内のすべてのプロファイラ間で共有されるため、必要に応じてグループ化するために利用できます。
6262

6363
---
6464

65-
## Usage {/*usage*/}
65+
## 使用法 {/*usage*/}
6666

67-
### Measuring rendering performance programmatically {/*measuring-rendering-performance-programmatically*/}
67+
### レンダーのパフォーマンスをプログラムで測定する {/*measuring-rendering-performance-programmatically*/}
6868

69-
Wrap the `<Profiler>` component around a React tree to measure its rendering performance.
69+
React ツリーを `<Profiler>` コンポーネントで囲むことで、そのレンダーのパフォーマンスを測定します。
7070

7171
```js {2,4}
7272
<App>
@@ -77,25 +77,25 @@ Wrap the `<Profiler>` component around a React tree to measure its rendering per
7777
</App>
7878
```
7979

80-
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.
80+
`id`(文字列)と `onRender` コールバック(関数)の 2 つの props が必要です。React はツリー内のコンポーネントが更新を「コミット」するたびにこれを呼び出します。
8181

8282
<Pitfall>
8383

84-
Profiling adds some additional overhead, so **it is disabled in the production build by default.** To opt into production profiling, you need to enable a [special production build with profiling enabled.](https://fb.me/react-profiling)
84+
プロファイリングには追加のオーバーヘッドが発生するため、**デフォルトでは本番用ビルドでは無効になっています**。本番環境でプロファイリングを行うためには、[プロファイリングを有効にしたな特別な本番用ビルド](https://fb.me/react-profiling)を明示的に用いる必要があります。
8585

8686
</Pitfall>
8787

8888
<Note>
8989

90-
`<Profiler>` lets you gather measurements programmatically. If you're looking for an interactive profiler, try the Profiler tab in [React Developer Tools](/learn/react-developer-tools). It exposes similar functionality as a browser extension.
90+
`<Profiler>` を使うことで測定結果をプログラムで収集することができます。対話型のプロファイラを使いたい場合は、[React Developer Tools](/learn/react-developer-tools) の Profiler タブを試してみてください。これは同様の機能をブラウザの拡張機能として提供します。
9191

9292
</Note>
9393

9494
---
9595

96-
### Measuring different parts of the application {/*measuring-different-parts-of-the-application*/}
96+
### アプリケーションの複数部位を測定する {/*measuring-different-parts-of-the-application*/}
9797

98-
You can use multiple `<Profiler>` components to measure different parts of your application:
98+
アプリケーションの複数の部位を測定するために、複数の `<Profiler>` コンポーネントを使用することができます。
9999

100100
```js {5,7}
101101
<App>
@@ -108,7 +108,7 @@ You can use multiple `<Profiler>` components to measure different parts of your
108108
</App>
109109
```
110110

111-
You can also nest `<Profiler>` components:
111+
また、`<Profiler>` コンポーネントをネストすることもできます。
112112

113113
```js {5,7,9,12}
114114
<App>
@@ -126,7 +126,7 @@ You can also nest `<Profiler>` components:
126126
</App>
127127
```
128128

129-
Although `<Profiler>` is a lightweight component, it should be used only when necessary. Each use adds some CPU and memory overhead to an application.
129+
`<Profiler>` は軽量なコンポーネントですが、必要な場合にのみ使用するべきです。使用するたびにアプリケーションに一定の CPU とメモリのオーバーヘッドが生じます。
130130

131131
---
132132

0 commit comments

Comments
 (0)