How we made our React-Rails app 5x faster
blog.progressly.com
blog.progressly.com
Huge red flag for a project. Checking in minified files at any point of app development is a nightmare for developers. The fact that they were doing this at all is no good. And if you're reading this and your team is doing it, that's no good either!
The #1 thing you can do to speed up a SPA is server side rendering, which it doesn't look like this company is doing https://progressly.com/engineering#/engineering. The entire page is blank for almost a second on each load. Was it 5s before? I sure hope not! But the tactics mentioned in this article are insignificant to actual server rendering.
We have a similar project and decided to just put everything React-related into "client" directory in Rails, then, once webpack builds production-ready files, it puts them into public/assets (during container build time). And that's it, I can run React without Rails, vice versa, test them independently,... etc.
A frontend app using create-react-app has everything to compose js files, load css and even manage sha1 suffixed asset file names.
I wonder if there is a well established pattern for server side rendering of some pages in this kind of applications. Obviously one can use Rails views for some important pages but how not to duplicate HTML in Rails and React?
If you absolutely do need them, I would just separate them by routes.
The primary metric is DOMContentLoaded, then the time to finish all requests.
If it took N seconds to show the page, it now takes N/5?
By "improve" they surely mean reduce. How can a measurement be reduced by 500%? If load time has decreased to one fifth, it would have been clearer to write "load time was reduced by 80%"?
So "improved by 500%" means "improved by a factor of 5".
In the case of time, improving means reducing.
So time got reduced by a factor of 5.
Just as you can improve a golf score, or a marathon pace, or your BMI.
This kind of article is just a click bait. No data to support his claim.
path: production
? path.resolve(appRoot, 'public', 'webpack')
: path.resolve(appRoot, 'public', 'webpack')2. Get a CDN for static assets
3. Use Webpack, again, for making development easier
Saved you a click.
Inventory:
product quantity
1 2
1 5
2 -1
2 3
2 10
And having a counter cache for the sum per product (e.g.: product.inventory_quantity).Step 1: Have it be 5x slower than necessary
Step 2: Fix it
>Step 1: Have it be 5x slower than necessary
>Step 2: Fix it
Corollary:
Step3: Pat yourself on the back
Step4: Show everyone how clever you are