
A deep dive into crafting the slowest possible memory access pattern for summing integers in C++. Starting from sequential (fastest) and random access, the author systematically constructs worse patterns by exploiting cache line boundaries, page boundaries, set-associative cache conflicts, TLB/page-table entry locality, and finally DRAM row-buffer conflicts. The worst pattern — striding by 8 pages — achieves over 30% slower performance than random access (2.06B cycles vs 1.57B), by simultaneously defeating hardware prefetchers, causing cache set conflicts, and forcing page-table walks on nearly every access.
Nguồn: https://blog.weineng.me/posts/slowest_add. 8sync News chỉ tóm tắt và dẫn link; bản quyền nội dung thuộc tác giả và nguồn gốc.
Bài viết cung cấp 35 câu hỏi phỏng vấn React dành cho senior developer, xoay quanh các chủ đề như rendering behavior, hooks (useState, useRef, useEffect, useLayoutEffect), tính năng React 19 (Actions, useOptimistic, React Compiler), Server Components, tối ưu hiệu suất, quản lý state, React Router và testing. Mỗi câu hỏi đi kèm ví dụ code thực tế và giải thích chi tiết, tập trung vào hiểu bản chất React thay vì ghi nhớ API.
Lập trình viên senior cần đọc bài này để khắc phục lỗi thường gặp trong các câu hỏi thực tế về React—không chỉ là nhớ kỹ thuật mà là hiểu sâu về cơ chế hoạt động, từ rendering đến các tính năng mới nhất như Server Components và React Compiler, giúp họ ứng dụng kiến thức một cách chính xác trong công việc.
React Compiler là công cụ biên dịch thời gian xây dựng (build-time) tự động tối ưu hóa React bằng cách thay thế các phương thức memoization thủ công như useMemo, useCallback và React.memo bằng cơ chế memoization chi tiết do chính compiler phân tích tĩnh mã nguồn. Nó hỗ trợ cấu hình trên Vite, Next.js và Babel, cung cấp hướng dẫn refactor trước/sau, yêu cầu tuân thủ Rules of React, so sánh hiệu năng định tính, checklist triển khai từng bước và liệt kê các hạn chế còn tồn tại như class components hay external store subscriptions.
Lập trình viên nên đọc bài này để khám phá cách React Compiler tự động tối ưu hóa hiệu suất của ứng dụng bằng cách loại bỏ thủ công các kỹ thuật memoization phức tạp, giúp cải thiện hiệu suất và giảm codebase mà không cần thay đổi logic nghiệp vụ.
Phoenix LiveView mounts twice on first page load — once for the static HTTP dead render and again when the WebSocket connects. The common fix of guarding data loads with connected?/1 avoids double queries but breaks SEO, link previews, and no-JS fallback by leaving the dead render empty. This post explains why the double mount exists, what connected?/1 actually costs, and introduces an experimental fork that parks the dead-render socket in a short-lived GenServer and redeems it on WebSocket connect — skipping the second mount entirely. The fork adds an on_connect/1 callback for connection-only side effects (subscriptions, timers, presence) and provides migration patterns for data loads, connect params, and real-time data. The upstream Phoenix team is working on a more complete 'adoptable LiveViews' solution (issue #3551), but this fork serves as an interim stopgap.
Python 3.15 introduces explicit lazy imports via PEP 810, allowing modules to be deferred until their attributes are first accessed. This reduces startup latency and memory consumption, especially useful in large applications and CLI tools that conditionally use heavy libraries. The post demonstrates the feature using Python 3.15.0b1 (installable via uv or pyenv), profiles import times with the tuna tool showing pandas being skipped when unused, and walks through the internal mechanism using pdb breakpoints to observe sys.lazy_modules and sys.modules state changes during reification. PyCharm 2026.1 does not yet fully support the new lazy keyword syntax.
Wrapping the OpenTelemetry API in custom abstractions is a common but harmful pattern. Two specific anti-patterns are examined: forcing heap allocations by requiring collection types in wrapper signatures (bypassing OTel's carefully designed zero-allocation overloads), and lookup wrappers that perform dictionary or mutex-locked lookups on every record call instead of holding instrument references. Beyond performance, wrappers prevent developers from learning OTel itself, create maintenance burden, and complicate debugging. OTel already provides InMemoryExporter for testing, eliminating that common justification. Legitimate wrapper use cases include legacy migration dual-writing and strict governance requirements. The post points to OTel Weaver as an upstream code-generation approach for type-safe instrumentation without runtime wrappers.
The Linux 7.2 kernel's memory management (MM) subsystem has received several notable improvements now merged to Git. The headline change is an improvement to MGLRU's reclaim loop and dirty writeback handling, yielding up to 30% throughput gains for MongoDB with NVMe storage and up to 100% gains with slower I/O. Other improvements include faster batch freeing of order-0 pages (addressing vmalloc regressions), DAMON enhancements for pausing/resuming without state loss and monitoring general data attributes, KASAN speedups by removing ineffective stack/page-table tagging, and tightened mmap_miss hit accounting that reduces synchronous mmap readahead I/O for sparse random and strided memory access workloads.