Today I Learned - Rocky Kev

Tagged “performance”

  1. TIL why google recommends you avoid document.write()

    By injecting it with code, it bypasses the preload scanner. This means that the browser can’t request this file until it’s actually run the '<script>' block that inserts it, which is very much just-in-time (and too late).

  2. TIL prioritizing Javascript

    ... async and defer attributes should be used where possible to avoid render blocking of the DOM. Render blocking is when the browser must halt all rendering of the page in order to process a resource that the page depends on.

  3. TIL problem with AJAX

    Synchronous XHR is harmful for performance because the event loop and main thread is blocked until the request is finished, resulting in the page hanging until the data becomes available. fetch is a much more effective and efficient alternative with a simpler API, and has no support for synchronous fetching of data.

  4. TIL Web Performance with Javascript

    Overall, we should be loading the most important JS first to get the website working. Then load all your third-party scripts onto your web worker, which then responds with 'Success' once it loads, so you can then interact with it.

  5. TIL Performance tests

    While doing performance tests, I was curious how long a loop was running. I used the performance.now() trick.

  6. TIL the difference between single-threaded & multi-threaded architecture

    For web dev, we don't need it. We're not bottle-necked by the processing power. We're instead bottlenecked by the ability to read files/databases. We can simulate multi-threading (and improve our app's performance) using async/await.

  7. TIL Windowing in Browsers

    Windowing only allow you to render what's available. Using twitter as a example, with tweets, when you scroll through hundreds of tweets and inspect the DOM, they just put a bunch of blank space above so there's not like 400 tweets above you.

  8. TIL avoiding including Sourcemaps

    Sourcemaps are a base64 representation of the original source into a production-ready JavaScript asset.

  9. TIL Memoization performance

    Memorization in a nutshell: You catch the data if it exists already.

  10. TIL how images get displayed to the browser

    Image data is usually encoded in order to reduce file size. You can change when to decode the image.

  11. TIL adding an Event Listener to document

    When an element in the DOM is clicked, the event bubbles all the way up to the parent element (the document and then the window). This allows you to listen for events on the parent item and still detect clicks that happen inside it.

  12. TIL how to create a delay snippet for JS

    We check for any user interaction. The 'eventList' array has eventlisteners, listening to those movements. Or we wait 5 seconds. Then Switch the 'delay' attribute with 'src' attribute. Run the 'cookie.js' code!

  13. TIL about getting how long it takes for JS to execute

    This post took me 7.22 minutes to write.

  14. TIL map() only when you need it

    The origins of 'map()' was to create methods that allow us to manipulate array data without mutating it. It's part of the whole set of methods to make functional programming easier in Javascript.

  15. TIL not using the delete keyword for performance issues

    The delete keyword is used to remove a property from an object. Apparently, there is performance issues with `delete` with V8 Javascript Engine.

  16. TIL javascript async vs defer

    The order of operations in Async and Defer

See all tags.