- عنوان کتاب: Web Performance Fundamentals -A Frontend Developer’s Guide to Profile and Optimize React Web Apps
- نویسنده: Nadia Makarevich
- حوزه: توسعه فرانتاند
- سال انتشار: 2025
- تعداد صفحه: 303
- زبان اصلی: انگلیسی
- نوع فایل: pdf
- حجم فایل: 4.79 مگابایت
این کتاب درباره اصول اولیه عملکرد وب است که به ویژه برای توسعهدهندگان React مرتبط است. این کتابی درباره نحوه نوشتن کد React نیست. در حال حاضر کتابهای زیادی برای این کار وجود دارد. تقریباً برعکس است – درباره هر چیزی است که کد React نیست. هر چیزی که آن را احاطه کرده و به آنچه ما به عنوان Performance میشناسیم کمک میکند. در این کتاب، تکنیکهای مختلف مدیریت حالت یا نحوه تقسیم کامپوننتها را یاد نخواهید گرفت. با این حال، در سطح بسیار عمیقی یاد خواهید گرفت که چگونه نمودارهای Flame Performance، انواع مختلف رندر سرور و کلاینت، نحوه نقش استراتژیهای مختلف واکشی دادهها در عملکرد بارگذاری اولیه و موارد دیگر را ثبت و درک کنید. در فصل بعدی، “بیایید درباره Performance صحبت کنیم”، به این موضوع خواهیم پرداخت که چرا اصلاً باید نگران Performance باشیم، به جز سرگرمی شخصی. به علاوه، گزارش CrUX چیست، چرا مفید است و چند منبع دیگر برای شروع اندازهگیری Performance. در بخش «مقدمهای بر عملکرد بارگذاری اولیه»، نگاهی اولیه به پنلهای Chrome DevTools Performance و Lighthouse خواهیم داشت، متوجه میشویم که بارگذاری اولیه چیست و چگونه میتوان آن را از طریق معیارهایی مانند FCP و LCP اندازهگیری کرد و اولین اکتشافات خود را انجام خواهیم داد. در حین انجام این کار، بررسی خواهیم کرد که چگونه شرایط مختلف شبکه بر بارگذاری اولیه تأثیر میگذارند، CDN برای چیست و اصول اولیه کنترل حافظه پنهان را یاد خواهیم گرفت. در فصل «رندرینگ سمت کلاینت و نمودارهای Flame»، در ضبط و درک نمودارهای Flame Performance – همان هیولاهای رنگارنگی که هر کسی را که برای اولین (یا دهمین) بار آنها را میبیند، گیج میکند – مهارت پیدا خواهیم کرد. در حین انجام این کار، خواهیم فهمید که الگوی رندرینگ سمت کلاینت (CSR) چیست و چرا مهم است. در فصل «SPAها و معرفی INP»، با CSR و پسوند طبیعی آن، یعنی برنامه تک صفحهای (SPA) ادامه خواهیم داد. در حین انجام این کار، درباره DevTools بیشتر یاد خواهیم گرفت، به معیار عملکرد بعدی، INP، خواهیم پرداخت و گزارش Lighthouse را بیشتر بررسی خواهیم کرد. در “مقدمهای بر رندرینگ روی سرور (SSR)”، همانطور که حدس زدهاید، رندرینگ سمت سرور را بررسی خواهیم کرد. ما استراتژی پیشرندرینگ خودمان را پیادهسازی خواهیم کرد، هزینه معرفی SSR به یک برنامه قبلاً CSR را درک خواهیم کرد، SSR چگونه بر معیارهای بارگذاری اولیه تأثیر میگذارد، هیدراتاسیون چیست و چگونه SSR را به درستی در کد React پیادهسازی کنیم. فصل “اندازه بسته و آنچه باید در مورد آن انجام دهیم” بر اندازه جاوا اسکریپتی که تولید میکنیم و دلیل اهمیت (یا عدم اهمیت آن) تمرکز دارد. در فرآیند این بررسی، درباره فشردهسازی، جنبههایی از بارگذاری اولیه که اندازه جاوا اسکریپت میتواند تحت تأثیر قرار دهد، استاد تجزیه و تحلیل اندازه بسته خواهید شد، به تفاوت بین HTTP/1 و HTTP/2 و 3 اشاره خواهیم کرد، درباره پیشبارگذاری، تقسیم کد، درختلرزه، قالبهای مختلف ماژول، وابستگیهای انتقالی و احتمالاً موارد دیگر یاد خواهید گرفت. این یک فصل بزرگ است! در بخش «مقدمهای بر بارگذاری تنبل و تعلیق»، بررسی خود را در مورد اندازه بسته ادامه خواهیم داد و در مورد بارگذاری تنبل و تعلیق، که البته در اینجا جای تعجب ندارد، صحبت خواهیم کرد. نحوه پیادهسازی صحیح آنها و مثل همیشه، عواقب عدم پیادهسازی آنها چیست. در بخش «بارگذاری تنبل پیشرفته»، ما همچنان در مورد بارگذاری تنبل صحبت خواهیم کرد! از پیچیدگی و ظرافت این موضوع شگفتزده خواهید شد. اما در نتیجه، ما مهمترین مفاهیم پشت فریمورکهای frontend مانند Next.js، React Router یا Tanstack را خواهیم دانست، اینکه چرا به تقسیم کد در هر مسیر نیاز داریم، چرا همه فریمورکها یک کامپوننت Link ارائه میدهند، چگونه پیشبارگذاری را انجام دهیم، چگونه SSR با پیشبارگذاری وارد عمل میشود و حتی پروژه مطالعاتی خود را به فریمورک Tanstack منتقل میکنیم و نتایج را اندازهگیری میکنیم. فصل «واکشی دادهها و کامپوننتهای سرور React» سرانجام ما را از بستهها دور میکند. ما در مورد واکشی دادهها صحبت خواهیم کرد: روی کلاینت، روی سرور و بین آنها. نحوه پیادهسازی و تحلیل واکشی دادههای سمت کلاینت، از جمله محل و نحوه انجام پیشواکشی دادهها، چه اتفاقی میافتد اگر دادهها با فعال بودن رندر سمت سرور (SSR) واکشی شوند و هزینههای مرتبط. این ما را به کامپوننتهای سرور React میرساند – اینکه چه مشکلی را حل میکنند، چگونه آن را حل میکنند و چگونه به طور کلی آنها را درک کنیم. به علاوه، Streaming را به این ترکیب اضافه میکنیم و همه چیز را با امتحان کردن Next.js علاوه بر Tanstack بهبود میبخشیم. از عملکرد بارگذاری اولیه خسته شدهاید؟ در فصل “عملکرد تعامل”، بالاخره از آن فاصله میگیریم و روی تعاملات تمرکز میکنیم. نحوه پیمایش Chrome DevTools در مورد تعاملات، Long Task چیست و چگونه با تسلیم شدن به main با آن مبارزه کنیم، چگونه برای توسعهدهندگان React مرتبط است و React DevTools چه چیزی در اینجا ارائه میدهد. فصل “خلاص شدن از رندرهای مجدد غیرضروری” React-y ترین فصل در اینجا است و کاملاً بر API React تمرکز دارد. ما در اینجا با مبارزه و پیروزی در نبرد علیه رندرهای مجدد غیرضروری و مخفیانه، عملکرد تعامل را بهبود خواهیم بخشید. تمام موارد کلاسیک: جابجایی state، ارسال کامپوننتها به عنوان فرزند، تمرین Context و props، و البته memoization. آیا همه چیز در مورد memoization در React خون شما را به جوش میآورد؟ در بخش “کامپایلر React”
The book is about the fundamentals of web performance that are particularly relevant for React developers. This is not a book about how to write React code. There are plenty of books for that already. It’s almost the opposite – it’s about everything that is not React code. Everything that surrounds it and contributes to what we know as Performance. In this book, you won’t learn different state management techniques or how to split components. However, you will learn on a very deep level how to record and understand Performance Flame Graphs, different types of server and client rendering, how different data fetching strategies contribute to initial load performance, and so much more. In the next chapter, “Let’s Talk About Performance”, we’ll look into why bother with performance in the first place, other than for personal entertainment. Plus, what the CrUX report is, why it’s useful, and a few other resources to get you started with measuring performance. In “Intro to Initial Load Performance,” we’ll take a first look at the Chrome DevTools Performance and Lighthouse panels, understand what Initial Load is and how to measure it via metrics like FCP and LCP, and make our first few discoveries. While doing so, we’ll investigate how different network conditions influence initial load, what a CDN is for, and learn the basics of Cache Control. In the “Client-Side Rendering and Flame Graphs” chapter, we’ll become proficient in recording and understanding the Performance Flame Graphs – you know, those colorful monstrosities that confuse everyone who sees them for the first (or tenth) time. While doing so, we’ll understand what the Client-Side Rendering (CSR) pattern is and why it’s important. In the “SPAs and Introducing INP” chapter, we’ll continue with CSR and its natural extension, the Single-Page Application (SPA). While doing so, we’ll learn more about DevTools, touch on the next performance metric, INP, and look more into the Lighthouse report. In the “Intro to Rendering on the Server (SSR)”, we’ll investigate, you’ve guessed it, Server-Side Rendering. We’ll implement our own pre-rendering strategy, understand the cost of introducing SSR to a previously CSR app, how SSR affects initial load metrics, what hydration is, and how to implement SSR properly in React code. The “Bundle Size and What to Do About It” chapter focuses on the size of JavaScript we’re producing and why it matters (or doesn’t matter). In the process of this investigation, you’ll learn about compression, which aspects of initial load the size of JavaScript can affect, become a master of bundle size analysis, touch on the difference between HTTP/1 and HTTP/2 & 3, learn about preloading, code splitting, tree shaking, different module formats, transitive dependencies, and probably more. It’s a huge chapter! In the “Intro to Lazy Loading and Suspense”, we’ll continue our investigation into the bundle size and talk about, no surprise here, lazy loading and Suspense. How to implement them properly, and as always, what the consequences are if you don’t. In the “Advanced Lazy Loading”, we’re still going to talk about lazy loading! You’d be surprised at how complicated and nuanced the topic is. But as a result, we’ll know the most important concepts behind frontend frameworks like Next.js, React Router, or Tanstack, why we need code splitting per route, why all frameworks give you a Link component, how to do preloading, how SSR comes into play with preloading, and even migrate our Study Project to the Tanstack framework and measure the results. The “Data Fetching and React Server Components” chapter finally leads us away from bundles. We’re going to talk about data fetching: on the client, on the server, and in between. How to implement and analyze client-side data fetching, including where and how to perform data prefetching, what happens if data is fetched with Server-Side Rendering (SSR) enabled, and the associated costs. This leads us to React Server Components – what problem they solve, how they solve it, and how to make sense of them generally. Plus, we’ll throw Streaming into the mix and polish everything by trying out Next.js in addition to Tanstack. Tired of initial load performance? In the “Interaction Performance” chapter, we’ll finally move away from it and focus on interactions. How to navigate Chrome DevTools when it comes to interactions, what a Long Task is and how to fight it by yielding to main, how it’s relevant to React developers, and what React DevTools have to offer here. The “Getting Rid of Unnecessary Re-renders” chapter is the most React-y chapter here and focuses entirely on the React API. We’re going to improve interaction performance here by fighting and winning the battle against sneaky unnecessary rerenders. All the classics: moving state around, passing components as children, Context and props drilling, and of course, memoization. Does everything about React memoization make your blood boil? In the “React Compiler” chapter, we’ll explore what the new, still experimental at the time of writing this book, tool has to offer for solving it. And is it worth it? Hope that’s enough content to keep you busy for a while! Now let’s set up the development environment and the Study Project, and let’s get started.
این کتاب را میتوانید از لینک زیر بصورت رایگان دانلود کنید:
Download: Web Performance Fundamentals
نظرات کاربران