Vercel launched Edge Functions, which are JavaScript, TypeScript, or WebAssembly functions that are generally both less expensive and faster than traditional serverless functions, according to the company.
Since the beta launch over the summer, Vercel added the ability to place Edge Functions into a specific region, added support for WebAssembly, and improved performance.
With the added abilities of lower latency, faster cold starts, and lower costs, developers can now move server-side logic to the edge and be closer to a visitor’s geographic location.
Edge Functions are able to run more efficiently than traditional serverless functions because they’re run on the lightweight Edge Runtime environment. Edge Functions are also published globally on every deployment to reduce the latency in executing a function.
“Running Edge Functions in the region closest to the user is an incredible way to reduce latency for APIs like OG Image Generation, which do minimal or no data fetching. But running globally can actually be slower when you need to query a database,” Vercel wrote in a post.
Moving forward, the company plans to improve the compatibility between Edge Functions and Serverless Functions and to have Edge Runtime be a proper and larger subset of the Node.js API.