Skip to content

Commit 74ad3a4

Browse files
authored
Merge pull request #59 from nafistiham/react-components-profiler
React components profiler
2 parents a3f90c1 + 1a5f99b commit 74ad3a4

File tree

4 files changed

+36
-35
lines changed

4 files changed

+36
-35
lines changed

src/components/DocsFooter.tsx

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ export const DocsPageFooter = memo<DocsPageFooterProps>(
3030
<div className="max-w-7xl mx-auto grid grid-cols-1 md:grid-cols-2 gap-4 py-4 md:py-12">
3131
{prevRoute?.path ? (
3232
<FooterLink
33-
type="Previous"
33+
type="পূর্ববর্তী পেইজ"
3434
title={prevRoute.title}
3535
href={prevRoute.path}
3636
/>
@@ -40,7 +40,7 @@ export const DocsPageFooter = memo<DocsPageFooterProps>(
4040

4141
{nextRoute?.path ? (
4242
<FooterLink
43-
type="Next"
43+
type="পরবর্তী পেইজ"
4444
title={nextRoute.title}
4545
href={nextRoute.path}
4646
/>
@@ -63,20 +63,21 @@ function FooterLink({
6363
}: {
6464
href: string;
6565
title: string;
66-
type: 'Previous' | 'Next';
66+
type: 'পূর্ববর্তী পেইজ' | 'পরবর্তী পেইজ';
6767
}) {
6868
return (
6969
<NextLink
7070
href={href}
7171
className={cn(
7272
'flex gap-x-4 md:gap-x-6 items-center w-full md:w-80 px-4 md:px-5 py-6 border-2 border-transparent text-base leading-base text-link dark:text-link-dark rounded-lg group focus:text-link dark:focus:text-link-dark focus:bg-highlight focus:border-link dark:focus:bg-highlight-dark dark:focus:border-link-dark focus:border-opacity-100 focus:border-2 focus:ring-1 focus:ring-offset-4 focus:ring-blue-40 active:ring-0 active:ring-offset-0 hover:bg-gray-5 dark:hover:bg-gray-80',
7373
{
74-
'flex-row-reverse justify-self-end text-right': type === 'Next',
74+
'flex-row-reverse justify-self-end text-right':
75+
type === 'পরবর্তী পেইজ',
7576
}
7677
)}>
7778
<IconNavArrow
7879
className="text-tertiary dark:text-tertiary-dark inline group-focus:text-link dark:group-focus:text-link-dark"
79-
displayDirection={type === 'Previous' ? 'left' : 'right'}
80+
displayDirection={type === 'পূর্ববর্তী পেইজ' ? 'left' : 'right'}
8081
/>
8182
<span>
8283
<span className="block no-underline text-sm tracking-wide text-secondary dark:text-secondary-dark uppercase font-bold group-focus:text-link dark:group-focus:text-link-dark group-focus:text-opacity-100">

src/components/Layout/Toc.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ export function Toc({headings}: {headings: Toc}) {
1616
<nav role="navigation" className="pt-20 sticky top-0 right-0">
1717
{headings.length > 0 && (
1818
<h2 className="mb-3 lg:mb-3 uppercase tracking-wide font-bold text-sm text-secondary dark:text-secondary-dark px-4 w-full">
19-
On this page
19+
এই পেইজে যা যা আছে
2020
</h2>
2121
)}
2222
<div

src/components/MDX/ExpandableCallout.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ const variantMap = {
2626
'linear-gradient(rgba(249, 247, 243, 0), rgba(249, 247, 243, 1)',
2727
},
2828
note: {
29-
title: 'Note',
29+
title: 'খেয়াল করুন',
3030
Icon: IconNote,
3131
containerClasses:
3232
'bg-green-5 dark:bg-green-60 dark:bg-opacity-20 text-primary dark:text-primary-dark text-lg',
@@ -35,15 +35,15 @@ const variantMap = {
3535
'linear-gradient(rgba(245, 249, 248, 0), rgba(245, 249, 248, 1)',
3636
},
3737
pitfall: {
38-
title: 'Pitfall',
38+
title: 'সতর্কতা',
3939
Icon: IconPitfall,
4040
containerClasses: 'bg-yellow-5 dark:bg-yellow-60 dark:bg-opacity-20',
4141
textColor: 'text-yellow-50 dark:text-yellow-40',
4242
overlayGradient:
4343
'linear-gradient(rgba(249, 247, 243, 0), rgba(249, 247, 243, 1)',
4444
},
4545
wip: {
46-
title: 'Under Construction',
46+
title: 'এই অংশের কাজ চলছে',
4747
Icon: IconNote,
4848
containerClasses: 'bg-yellow-5 dark:bg-yellow-60 dark:bg-opacity-20',
4949
textColor: 'text-yellow-50 dark:text-yellow-40',

src/content/reference/react/Profiler.md

Lines changed: 26 additions & 26 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>` আপনাকে একটা React ট্রিয়ের রেন্ডারিং পারফরম্যান্স প্রোগ্রামের সাহায্যে পরিমাপ করার সুযোগ দেয়।
88

99
```js
1010
<Profiler id="App" onRender={onRender}>
@@ -18,11 +18,11 @@ 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>` এর মধ্যে wrap করুন।
2626

2727
```js
2828
<Profiler id="App" onRender={onRender}>
@@ -32,41 +32,41 @@ 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.
35+
* `id`: একটা স্ট্রিং যেটা আপনি UI এর যে অংশ পরিমাপ করতে চান সেটাকে চিহ্নিত করতে ব্যবহৃত হয়।
36+
* `onRender`: এটা একটা [`onRender` কলব্যাক](#onrender-callback) যেটাকে প্রতিবার প্রোফাইল হতে থাকা ট্রিয়ের মধ্যকার কম্পোনেন্ট আপডেট হলে React কল করে। কী রেন্ডার হল এবং কেমন সময় লাগল এই তথ্যটা সে পায়।
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"`। এটা আপনাকে জানায় যে ট্রি কি এই প্রথম মাউন্ট হল নাকি prop, state বা hook এর পরিবর্তনের কারণে পরিবর্তিত হয়েছে।
58+
* `actualDuration`: বর্তমান আপডেটে `<Profiler>` এবং এর উত্তরসূরিদের রেন্ডার করতে যত মিলিসেকেন্ড খরচ হয়েছে সেই সংখ্যাটা। এটা নির্দেশ করে সাবট্রি মেমোইজেশন কতটা ভালভাবে ব্যবহার করতে পারছে (উদাহরণস্বরূপঃ [`memo`](/reference/react/memo) এবং [`useMemo`](/reference/react/useMemo))। সব ঠিকঠাক থাকলে এই মানটা প্রথম মাউন্টের পর থেকে উল্লেখজনকভাবে কমে যাবার কথা কারণ, উত্তরসূরিদের অনেকেরই পুনরায় রেন্ডার তখনই হবে যখন তাদের কোন prop এর পরিবর্তন হয়।
59+
* `baseDuration`: এই সংখ্যাটা বোঝায় যে কোন অপটিমাইজেশন ছাড়া পুরো `<Profiler>` সাবট্রি আবার রেন্ডার করার জন্য আনুমানিক কত মিলিসেকেন্ড লাগবে। সর্বশেষ রেন্ডারের জন্য ট্রিয়ের প্রতিটি কম্পোনেন্টে যে সময় লেগেছিল সেটা থেকে এই সংখ্যাটা হিসেব করা হয়। এই মানটা নির্দেশ করে রেন্ডারিং এর জন্য সবচেয়ে বেশি কত সময় লাগতে পারে (উদাহরণস্বরূপঃ একদম প্রাথমিক মাউন্ট বা মেমোইজেশন ছাড়া মাউন্টের সময়)। এর সাথে `actualDuration` তুলনা করে আপনি বুঝতে পারবেন মেমোইজেশন কাজ করছে কি না।
60+
* `startTime`: একটা সাংখ্যিক টাইমস্ট্যাম্প যা নির্দেশ করে কখন React বর্তমান আপডেট শুরু করেছিল।
61+
* `endTime`: একটা সাংখ্যিক টাইমস্ট্যাম্প যা নির্দেশ করে কখন React বর্তমান আপডেট commit করেছে। এই মানটা একটা কমিটে সব প্রোফাইলের সাথে শেয়ার করা হয়। যা তাদের প্রয়োজনে গ্রুপ হবার সুযোগ দেয়।
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>` কম্পোনেন্ট দিয়ে wrap করে ফেলুন।
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` কলব্যাক (ফাংশন) which React calls any time a component within the tree "commits" an update.
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+
প্রোফাইলিং কিছু অতিরিক্ত overhead যুক্ত করে, তাই **বাই ডিফল্ট এটা প্রোডাকশন বিল্ডে বন্ধ থাকে।** প্রোডাকশন প্রোফাইলিং চালু করার জন্য আপনাকে [প্রোফাইলিং সক্রিয় আছে এমন একটি বিশেষ প্রোডাকশন বিল্ড](https://fb.me/react-profiling) enable করতে হবে।
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>` আপনাকে প্রোগ্রামেটিকালি পরিমাপ জানতে সাহায্য করে। আপনি যদি interactive প্রোফাইলার চান, তাহলে [React ডেভেলপার টুলসের](/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 এবং Memory এর উপরে অতিরিক্ত কিছু চাপ পড়ে।
130130

131131
---
132132

0 commit comments

Comments
 (0)