Skip to content

Commit c8c3678

Browse files
authored
Translated react: Components > <Profiler> (#515)
1 parent a2ed2ce commit c8c3678

File tree

1 file changed

+27
-25
lines changed

1 file changed

+27
-25
lines changed

src/content/reference/react/Profiler.md

Lines changed: 27 additions & 25 deletions
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>` memungkinkan Anda mengukur performa *rendering* dari sebuah pohon React secara terprogram.
88

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

1919
---
2020

21-
## Reference {/*reference*/}
21+
## Referensi {/*reference*/}
2222

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

25-
Wrap a component tree in a `<Profiler>` to measure its rendering performance.
25+
Bungkus pohon komponen dalam `<Profiler>` untuk mengukur performa *rendering*.
2626

2727
```js
2828
<Profiler id="App" onRender={onRender}>
@@ -32,18 +32,20 @@ Wrap a component tree in a `<Profiler>` to measure its rendering performance.
3232

3333
#### 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.
3735

38-
#### Caveats {/*caveats*/}
36+
* `id`: String yang mengidentifikasi bagian UI yang sedang Anda ukur.
37+
* `onRender`: Sebuah [`onRender` *callback*](#onrender-callback) yang dipanggil oleh React setiap kali komponen dalam pohon yang diprofilkan diperbarui. Menerima informasi tentang apa yang di-*render* dan berapa lama waktu yang dibutuhkan.
3938

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)
39+
40+
#### *Caveats* {/*caveats*/}
41+
42+
* Pembuatan *profiler* akan menambah waktu komputasi, sehingga **dinonaktifkan dalam *build* produksi secara bawaan.** Untuk menggunakan *profiler* dalam produksi, Anda harus mengaktifkan sebuah [*build* produksi spesial dengan opsi pembuatan *profiler*.](https://fb.me/react-profiling)
4143

4244
---
4345

44-
### `onRender` callback {/*onrender-callback*/}
46+
### `onRender` *callback* {/*onrender-callback*/}
4547

46-
React will call your `onRender` callback with information about what was rendered.
48+
React akan memanggil `onRender` *callback* Anda dengan informasi tentang apa yang sudah di-*render*.
4749

4850
```js
4951
function onRender(id, phase, actualDuration, baseDuration, startTime, commitTime) {
@@ -53,20 +55,20 @@ function onRender(id, phase, actualDuration, baseDuration, startTime, commitTime
5355

5456
#### Parameters {/*onrender-parameters*/}
5557

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.
58+
* `id`: String `id` prop dari pohon `<Profiler>` yang baru saja di-*commit*. Ini memungkinkan Anda mengidentifikasi bagian mana dari pohon yang di-*commit* jika Anda menggunakan beberapa *profiler*.
59+
* `phase`: `"mount"`, `"update"` atau `"nested-update"`. Hal ini memungkinkan Anda mengetahui, apakah pohon baru saja dipasang untuk pertama kali, atau di-*render* ulang karena ada perubahan pada *props*, status, atau *hooks*.
60+
* `actualDuration`: Jumlah milidetik yang dihabiskan untuk me-*render* `<Profiler>` dan turunannya untuk pembaruan terkini. Ini mengindikasikan seberapa baik *sub*-pohon menggunakan memoisasi (contohnya [`memo`](/reference/react/memo) dan [`useMemo`](/reference/react/useMemo)). Idealnya, nilai ini akan berkurang secara signifikan setelah pemasangan awal, karena banyak keturunan yang hanya perlu me-*render* ulang jika *props* tertentu mereka berubah.
61+
* `baseDuration`: Jumlah milidetik yang memperkirakan berapa lama waktu yang dibutuhkan untuk me-*render* ulang seluruh *sub*-pohon `<Profiler>` tanpa pengoptimalan apa pun. Dihitung dengan menjumlahkan durasi *render* terbaru dari setiap komponen dalam pohon. Nilai ini memperkirakan biaya kasus terburuk dari *rendering* (misalnya, pemasangan awal atau pohon tanpa memoisasi). Bandingkan `actualDuration` dengan nilai ini untuk melihat apakah memoisasi berfungsi.
62+
* `startTime`: Stempel waktu numerik untuk mengetahui kapan React mulai me-*render* pembaruan terkini.
63+
* `endTime`: Stempel waktu numerik untuk mengetahui kapan React melakukan pembaruan terkini. Nilai ini dibagi di antara semua *profiler* dalam sebuah *commit*, sehingga memungkinkan untuk dikelompokkan jika diinginkan.
6264

6365
---
6466

65-
## Usage {/*usage*/}
67+
## Penggunaan {/*usage*/}
6668

67-
### Measuring rendering performance programmatically {/*measuring-rendering-performance-programmatically*/}
69+
### Mengukur performa *rendering* secara terprogram {/*measuring-rendering-performance-programmatically*/}
6870

69-
Wrap the `<Profiler>` component around a React tree to measure its rendering performance.
71+
Bungkus komponen `<Profiler>` di sekitar pohon React untuk mengukur performa *rendering*nya.
7072

7173
```js {2,4}
7274
<App>
@@ -77,25 +79,25 @@ Wrap the `<Profiler>` component around a React tree to measure its rendering per
7779
</App>
7880
```
7981

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.
82+
Dua *props* dibutuhkan untuk ini: sebuah `id` (string) dan *callback* `onRender` (fungsi) yang dipanggil oleh React kapan pun sebuah komponen di dalam pohon melakukan pembaruan.
8183

8284
<Pitfall>
8385

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)
86+
Pembuatan *profiler* akan menambah waktu komputasi, sehingga **dinonaktifkan dalam *build* produksi secara *default*.** Untuk menggunakan *profiler* dalam produksi, Anda harus mengaktifkan sebuah [*build* produksi spesial dengan opsi pembuatan *profiler*.](https://fb.me/react-profiling)
8587

8688
</Pitfall>
8789

8890
<Note>
8991

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.
92+
`<Profiler>` memungkinkan Anda mengumpulkan pengukuran secara terprogram. Jika Anda mencari *profiler* interaktif, cobalah tab *Profiler* di [React Developer Tools](/learn/react-developer-tools). Alat ini memiliki fungsionalitas yang serupa sebagai ekstensi peramban.
9193

9294
</Note>
9395

9496
---
9597

96-
### Measuring different parts of the application {/*measuring-different-parts-of-the-application*/}
98+
### Mengukur berbagai bagian aplikasi yang berbeda {/*measuring-different-parts-of-the-application*/}
9799

98-
You can use multiple `<Profiler>` components to measure different parts of your application:
100+
Anda dapat menggunakan beberapa komponen `<Profiler>` untuk mengukur bagian yang berbeda dari aplikasi Anda:
99101

100102
```js {5,7}
101103
<App>
@@ -108,7 +110,7 @@ You can use multiple `<Profiler>` components to measure different parts of your
108110
</App>
109111
```
110112

111-
You can also nest `<Profiler>` components:
113+
Anda juga dapat menyarangkan komponen `<Profiler>`:
112114

113115
```js {5,7,9,12}
114116
<App>
@@ -126,7 +128,7 @@ You can also nest `<Profiler>` components:
126128
</App>
127129
```
128130

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.
131+
Meskipun `<Profiler>` adalah komponen yang ringan, komponen ini sebaiknya digunakan hanya jika diperlukan. Setiap penggunaan akan menambah beban CPU dan memori pada aplikasi.
130132

131133
---
132134

0 commit comments

Comments
 (0)