Why Baidu Chose San: A Deep Dive into Its Performance, Compatibility, and Ecosystem
This article examines Baidu's home‑grown MVVM framework San, tracing its origins, core features, size and performance benchmarks, ecosystem tools such as CLI and DevTools, and real‑world deployments across Baidu App, feed pages, and mini‑programs, highlighting why it became the unified front‑end solution.
Frontend Evolution
Over the past 10‑15 years JavaScript has transformed from simple, unstructured scripts into a powerful ecosystem capable of building full‑featured cross‑platform applications.
The Birth of San
Before 2016 Baidu’s front‑end teams still relied heavily on jQuery, even though IE8 held a non‑trivial market share. The need for a lightweight, high‑performance framework that could run on low‑end browsers and support both PC and mobile led to the creation of San, which was officially released in 2016.
San is likened to a reliable off‑road vehicle: not the flashiest, but sturdy enough to carry developers to any destination.
Key Features of San
San is a minimalistic, performance‑focused MVVM component framework. It uses declarative HTML‑like templates, supports data‑to‑view binding, conditional and loop directives, and compiles templates into a virtual node tree for efficient updates. Components act as independent units of data, logic, and view, following a lifecycle similar to Web Components and supporting nested component hierarchies.
San also offers server‑side rendering (SSR) to address SEO and initial load latency, and a suite of surrounding open‑source projects that help build large, maintainable single‑page applications.
Size Comparison
Performance Comparison
Data source: https://krausest.github.io/js-framework-benchmark/current.html
Comparison with Other Frameworks
San is especially suitable for simple front‑end business logic. It provides better compatibility (IE6+) and smaller bundle size compared to Vue or React, which offer many communication patterns and rapid feature changes that can increase maintenance risk.
Unlike Vue, San’s API is more restrained, offering fewer built‑in communication methods and discouraging mixins, aligning with modern best practices such as Vue 3’s Composition API.
Ecosystem Construction
San CLI – interactive project scaffolding, built‑in Webpack configuration, and plugin system.
San Store – Flux‑like state management.
San Update – Immutable data updater.
San SSR – Server‑side rendering framework.
San DevTools – Chrome extension for debugging components and events.
UI component libraries: San UI (internal), Santd (Ant Design based), and San‑mui (Material Design based).
Adoption in Baidu APP
Unifying the front‑end stack across Baidu APP reduced duplicated effort, improved code quality, and enabled component reuse between PC and mobile. Since the end of 2018 Baidu has standardized on San for H5, mini‑programs, San‑native, and SSR solutions.
Technical selection reasons include:
Business characteristics demand lightweight, flexible components with excellent compatibility.
External libraries like Vue/React evolve quickly, risking frequent breaking changes.
San provides a universal framework for web, mini‑program, native, and SSR, enabling “Write Once, Run Anywhere”.
San now powers Baidu APP feed landing pages, search result pages, personal dynamic pages, user homepages, topics, and search channels.
Typical Deployment Scenarios
Wise Search Front‑end
Target: C‑end users, billions of users.
Tech stack: san, san‑ssr, san‑ssr‑target‑php.
Migration steps:
Componentize legacy Smarty templates into San components.
Use cross‑platform SSR to compile once for PHP and Node.js during transition.
Finalize with Node.js‑only SSR, eliminating the need for code rewrites.
San’s SSR moves parsing to compile time, reducing runtime overhead.
Feed Channel / Search Six‑Channel Front‑end
Target: C‑end users, billions.
Tech stack: san + san‑store + san‑update, san‑ssr, san‑cli.
Benefits include a 30% increase in development efficiency, 20%+ performance gains, 26% reduction in first‑byte time, 56% faster content rendering, and a 16% reduction in HTML payload size.
San in Baidu Mini‑programs
San serves as the rendering engine for Baidu mini‑programs, providing component‑based development, performance optimizations, and a compressed template format (ANode) that reduces startup time by over 20 ms.
Related Projects
Core libraries: san, san‑router, san‑factory, san‑store, san‑update.
Toolchain: san‑cli, san‑loader, san‑hot‑loader, san‑ssr, san‑devTools, san‑test‑utils, san‑anode‑utils, docit.
UI libraries: san‑mui, santd, san‑mui.
Cross‑platform solution: talos (san‑native based dynamic view framework).
Further Reading
San – a traditional MVVM component framework: https://efe.baidu.com/blog/san-a-traditional-mvvm-component-framework/
Why San is so fast: https://efe.baidu.com/blog/san-perf/
Discussion on Zhihu: https://www.zhihu.com/question/65498751/answer/294265707
Get Involved
Contribute issues to the San repository: https://github.com/baidu/san
Develop plugins for san‑cli: https://ecomfe.github.io/san-cli/#/architecture
Build plugins for the san‑cli UI: https://ecomfe.github.io/san-cli/#/ui/structure
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
