惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

博客园 - Franky
IT之家
IT之家
酷 壳 – CoolShell
酷 壳 – CoolShell
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
C
Check Point Blog
月光博客
月光博客
Jina AI
Jina AI
S
SegmentFault 最新的问题
WordPress大学
WordPress大学
博客园 - 叶小钗
人人都是产品经理
人人都是产品经理
博客园 - 司徒正美
腾讯CDC
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
有赞技术团队
有赞技术团队
博客园 - 聂微东
Hugging Face - Blog
Hugging Face - Blog
小众软件
小众软件
Last Week in AI
Last Week in AI
V
V2EX
罗磊的独立博客
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
阮一峰的网络日志
阮一峰的网络日志
NISL@THU
NISL@THU
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
T
Threat Research - Cisco Blogs
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
L
Lohrmann on Cybersecurity
宝玉的分享
宝玉的分享
爱范儿
爱范儿
T
Troy Hunt's Blog
量子位
Project Zero
Project Zero
S
Secure Thoughts
V
Visual Studio Blog
美团技术团队
AI
AI
博客园 - 【当耐特】
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
The Last Watchdog
The Last Watchdog
V
Vulnerabilities – Threatpost
P
Privacy International News Feed
Spread Privacy
Spread Privacy
Schneier on Security
Schneier on Security
博客园_首页
P
Privacy & Cybersecurity Law Blog
博客园 - 三生石上(FineUI控件)
Apple Machine Learning Research
Apple Machine Learning Research
N
News | PayPal Newsroom

Inside Nutrient

A guide to the invisible work behind documents Introducing Nutrient Documents for Salesforce: Native document generation and signing Document AI vs. traditional OCR: Choosing between OCR, AI, and hybrid pipelines PDF SDK compliance and security evaluation checklist for enterprise teams (2026) Invariant Corp replaces paper processes with Nutrient Workflow and scales without limits What is process mapping? A complete guide Nutrient vs. Conga Composer for Salesforce document generation (2026) Document routing: How to automate document distribution The CTO’s AI playbook: Why accountability architecture beats orchestration Compliance workflow automation: Why built-in compliance is table stakes Workflow diagrams: Examples, symbols, and how to build one that actually runs Digital forms: Replace paper forms with automated workflows Approval workflow software: How to automate approvals Why document-centric automation is different The CEO’s AI playbook: Why decision architecture beats model selection Nutrient SDK product updates for Q1 2026 PDF redaction verification: How to prove sensitive data is permanently removed What is a VPAT? The complete guide to accessibility conformance reports What is PDF/UA? The accessible PDF standard explained Salesforce eSignatures: Generate, sign, and track documents in one flow Online document viewer: Options, tradeoffs, and how to embed one Document viewer for web apps: React, Vue, Angular (2026) Best document viewers in 2026: A buyer’s guide How to edit a PDF in Python: Add text, images, and annotations Nutrient advances Workflow platform with agentic AI for enterprise-grade speed and consistency in document-heavy operations How to create a Salesforce quote template from opportunity data The business case for accessibility: Five ways it drives enterprise value Python PDF library comparison (2026): 7 libraries for developers Why your AI agent hallucinates PDF table data PDF.js limitations: When to upgrade to a commercial PDF SDK How Subject scaled 5× with Nutrient’s PDF SDK without rebuilding its document layer I replaced our sales training with an AI coach that runs in Slack — here’s what broke Redirecting to: https://securitybuzz.com/cybersecurity-news/why-enterprise-permissions-are-ais-most-dangerous-inheritance/ Nutrient .NET SDK vs. iText Core: Complete comparison for .NET developers DocuVieware: Support’s most frequently asked setup questions Introducing Nutrient Workflow How to convert PDF to Word in C# (.NET) When email and spreadsheets stop working: Work order approval workflows for field teams on the move Compliance with confidence: Why document-centric automation is the foundation of your mission Nutrient expands AI Assistant, automating multistep document workflows inside any application What is document generation? A developer’s guide to PDF generation Document Converter data flow and how real-time watermarks skip the queue PDF/UA compliance guide: Requirements, standards, and best practices Computers still can’t understand you How Athena Intelligence built AI agents for regulated enterprises with Nutrient’s document infrastructure How to convert HTML to PDF (2026): 4 methods from browser print to SDK How to build a document extraction pipeline with Nutrient Vision API OCR vs. intelligent document processing: Choosing the right document extraction engine Beyond OCR: How document intelligence eliminates manual processing in regulated industries Nutrient vs. IronPDF: Complete comparison for .NET developers Nutrient vs. Aspose.PDF: Complete comparison for .NET developers Redirecting to: https://fortune.com/2026/02/19/openclaw-who-is-peter-steinberger-openai-sam-altman-anthropic-moltbook/ Lufthansa Systems uses Nutrient to deliver reliable, scalable PDF rendering for pilots worldwide Nutrient vs. Syncfusion: Complete comparison for .NET developers React’s useTransition: The hook you’re probably using wrong First City Monument Bank streamlines banking processes with Nutrient Workflow Redirecting to: https://www.sdcexec.com/warehousing/automation/article/22957364/nutrient-workflow-automation-the-missing-link-in-supply-chain-efficiency The complete guide to digital signatures: PAdES, CAdES, and XAdES explained Nutrient Python SDK: Production-grade document processing for Python Introducing agentic document editing for web applications with AI Assistant Nutrient vs. QuestPDF: Complete comparison for .NET developers How we fixed the GdPicture license expiration (and what to do if you’re affected) Red team security testing with agentic AI The future of healthcare document automation Best healthcare workflow software compared Nutrient SDK product updates for Q4 2025 How Harvey scaled legal document workflows 50 percent MoM without rebuilding infrastructure HIPAA-compliant document management in hospitals Automated PII removal with Nutrient API Redirecting to: https://www.devopsdigest.com/2026-low-code-no-code-predictions Redirecting to: https://www.kmworld.com/Articles/Editorial/ViewPoints/Leaders-predict-AI-to-continue-permeating-all-aspects-of-KM-in-2026-172594.aspx What are deep agents and how do they solve complex problems? Whipping up document magic: Your easy-bake recipe for Vue and Nutrient Web SDK 🧁 What I’ve learned about product iteration planning while building SDKs Passwordless document signing: Three-layer security guide New zip folder functionality streamlines file management in Document Automation Server The keyboard shortcuts playbook: Taking control of keyboard events in Nutrient Web SDK From experienced engineer to AI beginner: My unexpected journey AI-assisted manual testing: Handling Safari’s PDF rendering and UI quirks How to keep a 20-year-old SDK up to date How we optimized rendering performance while handling thousands of annotations in React — Part 1 Nutrient announces new executive hires to accelerate next phase of growth High performance UI using web workers Automate document conversion at scale with Python and Nutrient DCS From curiosity to PLG (and AI): My journey to understanding product-led growth Prost to progress: One year as Nutrient Pigeon usage at Nutrient: Bridging native SDKs to Flutter Modernizing CI build servers: How to migrate from Chef to Ansible Unix man pages: AI-friendly documentation since 1971 Consistent hashing for even load distribution Best AI redaction APIs: Complete comparison guide for 2025 Why AI document redaction matters for modern security From coding to coordinating: How AI transformed my workflow What is intelligent document processing (IDP)? A complete guide Enterprise PDF SDKs: Best PSPDFKit (now Nutrient) alternatives Nutrient SDK product updates for Q3 2025 GdPicture support best practices Redacting sensitive data with Nutrient AI redaction API How AI is transforming the customer experience at Nutrient: From instant answers to intelligent support How manual QA uses PR testing between releases
How we optimized rendering performance while handling thousands of annotations in React — Part 2
Igor Perzic · 2026-01-06 · via Inside Nutrient

In the first part of this series, we shared how our Nutrient Web Viewer SDK struggled with the same core challenge many React apps face: rendering performance at scale. When handling documents with thousands of annotations, noticeable lag occurred during zooming, panning, and other interactions. We used React Profiler and browser performance dev tools to pinpoint the bottlenecks. By deferring heavy tasks out of the render cycle, avoiding costly shallow copies, applying memoization, and offloading work to web workers, we made the user interface (UI) far more responsive and stable under heavy load.

But the problem remains: Rendering at this scale is still demanding, and our improvements were just the first step. In this follow-up, we’ll continue addressing the same challenge and share how we pushed performance further, with techniques and architectural changes you can apply to your own large-scale React applications.

Identifying the culprit

The first step in solving this problem was figuring out which components were rerendering unnecessarily.

We started with the excellent React Scan(opens in a new tab) library. It gave us a high-level view of which components were being redrawn and how often. That was extremely helpful, but only up to a point. Some of our components are fairly complex, with multiple nested custom hooks, and React Scan doesn’t always show why a rerender happened. We encountered the same issue with React Developer Tools; however, it was fixed(opens in a new tab) in the meantime.

To dig deeper, we wrote our own debugging hook to log the exact props that triggered a rerender. It worked like a diff, comparing the previous props with the current ones and printing out what changed.

Here’s a small custom hook we used:

function useLogWhyRendered<T extends Record<string, any>>(

props: T,

name: string = "Component"

): void {

const prevProps = useRef<T>(props)

useEffect(() => {

const changedProps: { key: keyof T; prev: T[keyof T]; next: T[keyof T] }[] = []

for (const key in props) {

if (props[key] !== prevProps.current[key]) {

changedProps.push({

key,

prev: prevProps.current[key],

next: props[key],

})

}

}

if (changedProps.length > 0) {

console.groupCollapsed(`${name} props changed:`)

changedProps.forEach(({ key, prev, next }) => {

console.log(

`${String(key)} changed:`,

"\nOld:",

prev,

"\nNew:",

next

)

})

console.groupEnd()

}

prevProps.current = props

})

}

With this hook in place, we could finally see why React thought it needed to rerender. Often, it turned out to be something as subtle as passing down an object or function reference that was recreated on every render.

Research and solution: Targeted rerenders

The solution was simple in theory but required careful analysis: Ensure components only rerender when absolutely necessary.

Here’s how we approached it.

1. Stable references

One of the biggest lessons we learned was how crucial stable references are in React.

React compares props shallowly, meaning it only checks if references are the same, but not if the contents are equal. If you pass a new object, array, or function every time a component renders, React assumes it changed, even if the internal values haven’t.

This problem often hides in plain sight. The most common culprits are callbacks, inline style objects, or JSX children created on the fly.

And yes, this might sound like React 101. Most developers know about reference equality, but in practice, it’s surprisingly easy to get wrong. All it takes is one unstable dependency in a useCallback or useMemo hook to quietly invalidate memoization and trigger a cascade of rerenders.

Paying close attention to which values your hooks depend on and avoiding passing whole objects when only one property matters can make a huge difference in rendering performance:

// ❌ Causes rerenders every time.

<AnnotationItem style={{ color: 'red' }} onClick={() => handleClick(id)} />

// ✅ Keeps references stable.

const style = useMemo(() => ({ color: 'red' }), [])

const handleClickStable = useCallback(() => handleClick(id), [id])

<AnnotationItem style={style} onClick={handleClickStable} />

2. Correct dependency selection

Memoization is only effective when the right dependencies are chosen, and those dependencies should be as minimal as possible. This was particularly important for us because our SDK uses Immutable.js(opens in a new tab) in our global state.

Immutable.js guarantees that any update creates a new object reference, even if only a small part of the object has changed. This means that if we passed the entire annotation object as a dependency to useMemo or useCallback, any update to any property on any annotation would cause the hook to rerun, even if the part of the object we actually cared about hadn’t changed.

To fix this, we selected only the properties we actually needed from the annotation object:

const content = useMemo(

() => getAnnotationContent(annotation.id, annotation.type),

[annotation.id, annotation.type]

)

By narrowing the dependencies to just annotation.id and annotation.type, we prevented unnecessary recalculations whenever other fields of the annotation changed. This dramatically reduced wasted work and kept rendering focused on truly relevant changes.

3. Optimizing Redux’s useSelector

Many of our components used Redux’s useSelector to pull derived values from state. The issue? Every store update triggered rerenders, even when the underlying data didn’t change.

The root cause was that useSelector relies on reference equality to determine if the selected value has changed. That means any selector returning a new object or array on each call — for example, from .filter() or .map() — will always cause a rerender:

// ❌ New array every time → always rerenders.

const visibleAnnotations = useSelector(state =>

state.annotations.filter(a => a.visible)

)

To avoid this, ensure your selector returns the same reference when the underlying data hasn’t changed. One easy fix is to compute derived values inside a useMemo that depends only on the relevant slice of state:

function useVisibleAnnotations() {

const annotations = useSelector(state => state.annotations)

return useMemo(

() => annotations.filter(a => a.visible),

[annotations]

)

}

If your selector needs to return an object — for example, bundling several related fields together — consider using the shallowEqual comparison function to help useSelector detect when the actual content is the same:

// ✅ Avoids rerender if object fields didn't change.

const annotationInfo = useSelector(

state => ({

count: state.annotations.length,

visibleCount: state.annotations.filter(a => a.visible).length,

}),

shallowEqual

)

Now, React only rerenders when the relevant state truly changes, and not just because of a new object or array reference.

In short: useSelector sees references only, not values. Returning stable values (or comparing them shallowly when needed) can eliminate thousands of unnecessary renders and make your app feel dramatically smoother.

The result

After implementing targeted rerenders:

  • Hovering over an annotation no longer triggered rerenders for all annotations.
  • Toolbar updates were isolated to actual changes in toolbar state.
  • CPU usage dropped dramatically, and interactions became smooth again, even with thousands of annotations on a single page.

It was a classic case of “less is more,” quite literally. By carefully controlling what triggered rerenders, we transformed a sluggish UI into a responsive experience.