Company
Date Published
Author
Lakshya Singh
Word count
1949
Language
English
Hacker News points
None

Summary

SingleStore is a fast database that supports real-time ingestion, with highly parallel transactions and queries all at once. To improve its Portal UI, the company accelerated its Cloud Portal UI project to minimize initial loading times. The primary goal was to reduce the time it takes for the initial query to fetch required data after user authentication. By applying the "Golden Rule of Asking Only What is Required," they optimized GraphQL queries and reduced bulky queries that took forever to load. They also split their `getInitialData` query into two separate queries, one for a single organization and another for all organizations, to improve performance without blocking the initial render. Additionally, they fixed slowness in their "Create Workspace" form by optimizing workspaces data fetching. They created a custom hook to replace Apollo's `useQuery` hook, which manages states properly and internally uses the `useQuery` hook. The company also measured progress with tools like Lighthouse and Chrome developer tools, but realized the need for infrastructure changes such as compressing frontend assets, improving cache-miss state, and setting up a separate chunk for React vendors. They implemented lazy loading, treeshaking Lodash, and optimized their app bundle size by reducing unnecessary imports and using tree-shakeable alternatives. By applying these optimizations, they achieved significant improvements in core performance metrics like First Contentful Paint.