Thursday, September 19, 2024

ECMAScript Specs Approved, and How Google Sheets Used WasmGC

Must read

On Wednesday, the Ecma General Assembly approved the ECMAScript 2024 language specification, making the recommendations officially a part of the standard.

The new standards include a new way to create Promises that devs want to resolve, according to Axel Rauschmayer, a computer scientist who specializes in JavaScript, TypeScript and web development. Rauschmayer drills down on the new code standards, which are:

  • Grouping synchronous iterables
  • Promise.withResolvers()
  • Regular expression flag /v
  • New features for ArrayBuffers and SharedArrayBuffers
  • Ensuring that strings are well-formed
  • Atomics.waitAsync()

Google Sheets Team Used WasmGC to Replace JavaScript Calculation Engine

Google Sheets has found a use case for Wasm in the browser — or more precisely, Wasm Garbage Collection (WasmGC). It’s using WasmGC to replace its JavaScript calculation engine. The engine will now be Java code complied to WebAssembly, the team shared on Wednesday.

“At Google, we believe that WasmGC has the potential to be even more impactful than Wasm because of the popularity of garbage collected languages,” the post stated.

Google Sheet’s calculation engine, which handles calculations done with the spreadsheet, originally was built in Java with the calculations happened on the server. But starting in 2013, the engine ran in the browser using JavaScript.

“This was originally accomplished through Google Web Toolkit, and later through Java to Closure JavaScript transpiler,” the team explained. “The JavaScript calculation engine runs in a Web Worker and communicates with the main thread using a MessageChannel.”

The team used an internal validation mechanism, developed in-house, to validate the JavaScript version’s results and time against the Java version. They found that the JavaScript version was more than three times slower than the Java version.

The team explained why JavaScript is slower — it has to do with the loose types and dynamic behavior — and further outlined their process for refining the Sheets Wasm calculation engine, which at first was approximately two times slower than the JavaScript version.

“WasmGC is a powerful technology that has the potential to advance the way developers build web applications,” the team concluded. “Over the coming years, at Google, we hope to see WasmGC advance to support shared memory multithreading and further improve single threaded performance.”

Shopify’s New Developer Features

It’s been two years since Shopify, an e-commerce platform for building online stores, acquired Utopia, an open source integrated design and development environment for React. This week, that seems to be paying dividends: Shopify has integrated Utopia with its new Hydrogen Visual Editor, which is part of its Hydrogen stack for headless commerce framework.

The visual editor is a a WYSIWYG editor for headless storefronts that will bring “non-technical users into the editing flow and maximizing developer resources.”

So what does this do for frontend developers?

“With this new tool, you can stay in control of your builds as your code is always the source of truth,” the press release noted. “All changes sync to GitHub, with small and straightforward diffs. This means you can easily implement a custom interface your non-technical internal teams can use for simple copy and content changes, and templated page builds.”

Developers can also use existing tools such as VSCode, GitHub and CI/CD while merging branches and tagging releases to ship faster. Shopify noted that it had also made it easier to integrate data into pages, whether it’s from metaobjects, Shopify’s Storefront API or the organization’s own CMS. The visual editor will soon be available in early access.

The news was highlighted in a round up of developer updates for Shopify’s summer edition. Other items announced this week:

  • New Admin extensions, including a new print extension that enables easier order fulfillment tasks for merchants, such as printing invoices or packing slips. “All developers need to do is configure the extension and we’ll turn it into a printable asset by leveraging native browser capabilities,” the press release explained.
  • A Shopify Flow template app extension to allow attaching an automation to an app
  • Shopify Functions, which it notes have become more powerful with improvements to JSON parsing for JavaScript and a smaller Rust footprint
  • Updates to the Shopify CLI
  • Unified APIs with GraphQL
  • Declarative webhooks
  • .dev assistant, an AI-powered tool on Shopify.dev focused on helping developers learn and use Shopify’s GraphQL APIs.

Group Created with Sketch.

Latest article