Svelte 5 significantly departs from its JavaScript framework roots by compiling components directly to vanilla JavaScript instructions that manipulate the DOM. This eliminates the virtual DOM diffing process typical of other frameworks, resulting in smaller bundle sizes and potentially faster performance. Instead of a framework mediating interactions, Svelte 5 generates imperative code tailored to each component, directly updating the DOM. This shift allows for optimized updates and reduces runtime overhead, making Svelte 5 applications more akin to handcrafted JavaScript than traditional framework-driven applications. While still using familiar Svelte syntax, the output is now a highly optimized, self-contained JavaScript module.
Svelte 5 focuses on becoming smaller, faster, and simpler. It achieves this through aggressive optimization strategies like compile-time dead code elimination and reduced reliance on runtime helpers, resulting in significantly smaller bundle sizes. This "vanishing framework" approach allows Svelte to prioritize performance and developer experience by shifting more work to the compiler. Rich Harris discusses the future of frameworks, emphasizing a trend towards this disappearing act, where frameworks become less noticeable at runtime. He also touches on the increasing importance of interoperability between frameworks and the potential for component-level adoption. Svelte 5's changes are not just about immediate improvements, but represent a commitment to a long-term vision for streamlined and performant web development.
Hacker News users discussed Svelte 5's new features, particularly the reactivity improvements and reduced bundle size. Some expressed excitement about the direction Svelte is taking, praising its developer experience and performance. Others questioned the long-term viability of compiled frameworks and debated the merits of Svelte's approach compared to React or other established frameworks. Several commenters also brought up the importance of interoperability and the potential challenges of adopting a newer framework. A few users mentioned their positive experiences migrating to Svelte and highlighted the speed of development and small application size. Some skepticism was expressed about the limited server-side rendering capabilities and the relatively small community compared to React.
Threlte 8 introduces significant performance enhancements and new features to the Svelte Three.js wrapper. A key improvement is the move to a new, more efficient rendering loop using requestAnimationFrame
within Svelte's tick function, eliminating unnecessary re-renders and boosting FPS. Version 8 also embraces a new component-based architecture, improving code organization and maintainability. New components like <TCanvas>
and <TGroup>
simplify scene setup and object management. Additionally, Threlte 8 boasts improved developer experience through streamlined event handling, simplified camera controls, and a revamped documentation site. These updates solidify Threlte's position as a powerful and user-friendly tool for building 3D experiences with Svelte.
Hacker News users generally expressed enthusiasm for Threlte 8, praising its improvements to developer experience in using Three.js with Svelte. Several commenters highlighted the elegance of the new component-based approach and its similarity to React Three Fiber, making it easier to learn and use. Some discussed the benefits of Svelte's reactivity and smaller bundle sizes, while others appreciated the improved documentation and examples. One user raised a question about server-side rendering support, which the Threlte author clarified is being actively worked on. Overall, the sentiment was positive, with many commenters eager to try Threlte 8 in their projects.
Summary of Comments ( 192 )
https://news.ycombinator.com/item?id=43091596
HN users discuss Svelte 5's compilation strategy, which moves reactivity out of the JavaScript runtime and into compiled code. Several commenters express excitement over the potential performance benefits and smaller bundle sizes, comparing it favorably to React and other frameworks. Some raise concerns about debugging and the implications for the ecosystem, particularly around tooling. A few express skepticism, questioning whether the performance gains are significant enough to warrant the shift and whether Svelte's approach will hinder wider adoption. There's also discussion about the blurring line between frameworks and compilers, and whether Svelte's compiled output still qualifies as JavaScript. The impact on hydration and server-side rendering is also a topic of interest.
The Hacker News post "Svelte 5 is not JavaScript" (https://news.ycombinator.com/item?id=43091596) sparked a discussion revolving around Svelte's compilation strategy and its implications. Several commenters delve into the nuances of what "not JavaScript" truly means in this context.
One compelling line of discussion centers around the distinction between Svelte's compiled output and traditional JavaScript frameworks. Commenters point out that while Svelte components are written in a language that resembles JavaScript, the compiler transforms them into highly optimized vanilla JavaScript code. This compiled code, devoid of the Svelte runtime, directly manipulates the DOM, leading to performance gains. The discussion clarifies that the "not JavaScript" claim refers to the runtime execution environment, not the origin of the code. The ultimate deliverable is still JavaScript, but it's a very different kind of JavaScript than what's produced by frameworks like React or Vue.
Several comments explore the benefits of this compilation approach. Smaller bundle sizes, improved performance, and the potential for better tree-shaking are all highlighted. Commenters explain that by eliminating the runtime, Svelte avoids the overhead associated with virtual DOM diffing and other framework-specific processes. This leaner execution model contributes to faster initial load times and smoother updates.
Some comments delve into the technical details of Svelte's compilation process. They discuss how Svelte analyzes the component code and generates highly specific DOM manipulation instructions. This tailored approach, in contrast to the more generic nature of virtual DOM diffing, results in more efficient updates.
Another thread of discussion touches on the implications for developers. Some commenters express appreciation for Svelte's developer experience, highlighting the conciseness and readability of its component syntax. Others raise questions about debugging and tooling, noting the challenges that can arise when working with compiled code. The ability to easily step through and inspect original source code during debugging is mentioned as a potential area for improvement.
Finally, a few comments compare and contrast Svelte with other frameworks like React, Vue, and Solid.js. The discussion acknowledges the trade-offs associated with each approach. While Svelte's compilation strategy offers performance advantages, the other frameworks may provide benefits in terms of community size, tooling maturity, and ecosystem breadth.