June 22nd, 2024

Farm: Fast vite compatible build tool written in Rust

Farm is a Rust-based web building engine for efficient web programming. It accelerates React/Vue projects with fast updates, incremental building, module-level caching, and support for popular technologies like Sass, Less, Vue, and React.

Read original articleLink Icon
Farm: Fast vite compatible build tool written in Rust

Farm is a Rust-based web building engine designed to streamline web programming and serve as a JavaScript library. It boasts exceptional speed, allowing for the quick initiation of React/Vue projects and updates within 10ms in most cases. The tool supports incremental building with persistent cache and module-level caching, avoiding redundant compilations. Farm offers a wide range of features, including compiling HTML, CSS, JavaScript, and various assets, along with support for popular technologies like Sass, Less, Vue, and React through official plugins. It is fully pluggable and compatible with Vite, enabling partial bundling for faster resource loading while maintaining caching precision. Farm ensures consistency between development and production environments and is compatible with both legacy (ES5) and modern browsers. The platform is community-driven, with support available through WeChat groups and Discord, and is actively maintained by Farm, Inc.

Related

AdonisJS

AdonisJS

AdonisJS is a TypeScript-first web framework for Node.js, emphasizing type-safety, intellisense, and performance. It offers testing support, official packages like Lucid for SQL ORM, Auth for authentication, and a vibrant community.

Eight million pixels and counting: improving texture atlas allocation in Firefox (2021)

Eight million pixels and counting: improving texture atlas allocation in Firefox (2021)

Improving texture atlas allocation in WebRender with the guillotiere crate reduces texture memory usage. The guillotine algorithm was replaced due to fragmentation issues, leading to a more efficient allocator. Visualizing the atlas in SVG aids debugging. Rust's simplicity and Cargo fuzz testing are praised for code development and robustness. Enhancements in draw call batching and texture upload aim to boost performance on low-end Intel GPUs by optimizing texture atlases.

Exposition of Front End Build Systems

Exposition of Front End Build Systems

Frontend build systems are crucial in web development, involving transpilation, bundling, and minification steps. Tools like Babel and Webpack optimize code for performance and developer experience. Various bundlers like Webpack, Rollup, Parcel, esbuild, and Turbopack are compared for features and performance.

Adding view count and like button to 11ty

Adding view count and like button to 11ty

The article explains adding view count and like button to an 11ty blog using Express and Vercel serverless functions. It details challenges, solutions, code snippets, and suggests Next.js for easier integration.

Homegrown Rendering with Rust

Homegrown Rendering with Rust

Embark Studios develops a creative platform for user-generated content, emphasizing gameplay over graphics. They leverage Rust for 3D rendering, introducing the experimental "kajiya" renderer for learning purposes. The team aims to simplify rendering for user-generated content, utilizing Vulkan API and Rust's versatility for GPU programming. They seek to enhance Rust's ecosystem for GPU programming.

Link Icon 26 comments
By @9dev - 5 months
So, I decided to try this for a real-world project and compare the results. This is for a full production build with no cache, taking the best of three runs each.

Vite:

    2166 modules transformed.
    built in 28.21s
Farm:

    [ Farm ] Build completed in 13350ms FULL EXTREME! Resources emitted to ./dist.
    [ Farm ] Public directory resources copied successfully.
So that is 28.21s vs. 13.35s, or a 53% decrease in build times. This is certainly neat, but I'm not sure whether it is worth the dependency on a new player.
By @TikolaNesla - 5 months
I have mixed feelings about this project. It appears the author primarily aimed to rewrite Vite in Rust and then found justifications for doing so. From my experience, Vite is already sufficiently fast for most needs. Adopting a new and potentially unstable project for marginal performance improvements doesn't seem justifiable.
By @solatic - 5 months
Serious question: does anyone here work for a BigCo who uses Chinese software like this in production? Do your InfoSec teams sign off on it?

What's the risk of downloading what's supposed to be a release binary of this off GitHub, where the release binary includes something nefarious not found in the open codebase, that steals your company's source code when you use it to compile?

In today's geopolitical climate, how does anyone trust non-Western projects?

By @the_duke - 5 months
So, we have rspack, turbopack and now Farm, all written in Rust.

There is also Vite, of course , which is already quite fast and very popular.

What's the differentiator between those?

By @ccorcos - 5 months
Why aren’t we comparing to ESBuild?
By @Too - 5 months
I love how they compare the loading times by making the bars in the graph render as slowly as their benchmark measurement. Really delivers the message why the faster compilation time is worth it, instead of just showing a static graph with numbers.
By @EvanYou - 5 months
Note in the benchmark, it is comparing a React JSX project using @vitejs/plugin-react (Babel based) instead of @vitejs/plugin-react-swc (SWC based).

I made the exact same point two years ago when Turbopack came up with a similar benchmark: https://github.com/yyx990803/vite-vs-next-turbo-hmr/discussi...

The point is if we want to compare bundler performance, we should keep all the non-architectural variables consistent across all implementations. Otherwise we are not comparing apples to apples.

PR submitted to update the benchmark: https://github.com/farm-fe/performance-compare/pull/11

By @black_puppydog - 5 months
A WeChat link under "community".

Without wanting to make this specifically anti-chinese, I really wonder whether that makes it better or worse than only having the Discord link.

I find Discord as a community platform already quite questionable. Now add to that the simple fact of fragmenting your community into two... I'm not convinced.

By @phildenhoff - 5 months
I’ll have to look at this over the weekend. I’m very excited to see improvements in dev UX in the JS ecosystem. I’d have a very hard time adopting this in prod tho, being so new.

Are any large projects using it? Corporation sponsors?

By @erkelost - 5 months
For the current farm, in order to be more compatible with the front-end ecosystem, we have chosen to be compatible with the vite hook and options. But in fact, the biggest performance problem lies in the communication problem between js and rust. For example, if a vite plug-in uses a hook to obtain the entire resource pot, the entire communication will consume more than 10 times the time, so the future path of farm should be if we Avoid these problems and create farm rust plugins
By @jensenbox - 5 months
I would love to use it as a test but there is too much of a commitment in that it is not a drop in replacement for vite nor is there anything in the way of a doc or help for "migrate from vite to farm".

I stopped at "create" - I rather "install and convert" in a branch to try stuff out.

By @mirekrusin - 5 months
Where does money come from in Farm Inc.?
By @FireInsight - 5 months
> This page crashed. > > Error creating WebGL context.

I'm sorry, but WebGL probably shouldnt be a requirement for your front page to display any content at all. I disable it for privacy hardening and switch browsers to opt-in. Additionally, low-power clients may struggle with rendering and sink battery in mobile devices.

The docs work fine, if anyone else runs into this and wants to read about the project.

https://www.farmfe.org/docs/why-farm

By @antihero - 5 months
Is it like a drop in replacement? I’m working with a semi-legacy codebase that takes over a minute to compile and copy with YALC, so if this can squash that time to something more reasonable I’ll be extremely happy.
By @dangoodmanUT - 5 months
The scrolling is jumping around like crazy on iOS
By @throw156754228 - 5 months
Do I need a different npm package for this on ARM Macs vs my colleagues on Windows boxes?
By @ram_rar - 5 months
Can someone with expertise in frontend development help me understand the proliferation of similar tools in the field?

What specific optimizations do these tools offer that others can't, and why can't the slower tools simply adopt these optimizations in future updates?

Is this a result of a lack of consensus within the community, leading to the creation of new forked tools, or is there a larger strategic context that I'm missing?

By @evantbyrne - 5 months
Is it copyrighted to a fake company? I'm not seeing a "Farm, Inc" in EDGAR search.
By @techpression - 5 months
Any tool that wants to replace esbuild for me will have to write as good, or better, release notes. The cost of broken tooling and bad change logs (in other words, bad versions) are many orders of magnitude more expensive than the cost of staying on esbuild.
By @tamimio - 5 months
It looks promising, just a side a note: pink on white background was really hard to read, especially on phone screens.
By @hassannawaz - 5 months
idk if its just me but their website is falling apart on mobile
By @pjmlp - 5 months
I would rather have V8 JIT improvements and code caches, than the whole RIIR.

Maybe instead of using nodejs, use Go, Spring, Quarkus, Micronaut, ASP.NET, Axiom...