question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Improve loading of components with lots of data

See original GitHub issue

#174 / #177 fixes the load time of the devtools. This means we’ve closed #10 but we still get performance issues, localised to loading of component data.

This is an umbrella issue for 2 things we’re seeing after the above, for components with large $data eg. https://alpinetoolbox.com, the main “div” component:

  1. loading the component data can take a while (“get-data”, “set-data”)
  2. toggling attributes is sluggish

We still need to pinpoint where exactly the bottlenecks are, candidates:

  • preparing of the data for serialization (we traverse the data and generate a data structure for the panel)
  • JSON.stringify (the actual serialization might be costly for whatever reason)
  • sending a large string from the backend to the proxy to the app to state to the devtools (panel)
  • rendering the data in the panel with Alpine

Current ideas to fix bottlenecks (depending on where they are):

  • the stringification/serialization and parse/deserialization operations might be costly -> switch to a faster implementation, probably a library
  • making serialization an async process so it yields the event loop for execution of other operations (would keep the page/devtools more interactive)
  • reduce the size of the message by
    • changing the schema (eg. removing unused fields)
    • encoding it (Lempel Ziv? encoding performance would have to be weighed against the cost of a larger payload)
  • Alpine.js rendering optimisations, eg. x-show vs x-if, adding key to x-for’s

Notes

Ryan found this for profiling extensions https://gist.github.com/bvaughn/ab6a6aefcda21dd2db69c7eaa7bf3332

It’s probably worth adding a “load test”/“benchmark” Cypress example based on alpinetoolbox.com data.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:16 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
KevinBatdorfcommented, Mar 13, 2021

Left two potential optimizations here that i don’t think affect anything negatively but greatly improve responsiveness in my testing.

https://github.com/alpine-collective/alpinejs-devtools/pull/177#discussion_r593522339

0reactions
KevinBatdorfcommented, Mar 14, 2021

Yeah I agree we’re pretty good for now.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Five Data-Loading Patterns To Boost Web Performance
You don't need a framework for everything, but if you use one, this article will help you use it in the most performant...
Read more >
How To Speed Up Data Heavy React Components
Simple Technique To Boost Performance​​ Every time state is updated, the component is rendered. By default, React thinks every component render ...
Read more >
How to Optimize Components to Improve React Performance
In this tutorial, you will learn how to maximize React performance by measuring rendering bottlenecks and optimizing your components.
Read more >
Use lazy loading to improve loading speed - web.dev
This post explains lazy loading and why you might want to lazy-load elements on your site.
Read more >
9 Quick Ways to Improve Page Loading Speed - HubSpot Blog
1. Choose a performance-optimized hosting solution. · 2. Compress and optimize your images. · 3. Reduce your redirects. · 4. Cache your web...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found