Qwik
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Owners
        • Signed-in users
        • Everyone
        Owners Signed-in users Everyone
      • Write
        • Owners
        • Signed-in users
        • Everyone
        Owners Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
    • Invite by email
      Invitee

      This note has no invitees

    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Note Insights
    • Engagement control
    • Transfer ownership
    • Delete this note
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Versions and GitHub Sync Note Insights Sharing URL Help
Menu
Options
Engagement control Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Owners
  • Owners
  • Signed-in users
  • Everyone
Owners Signed-in users Everyone
Write
Owners
  • Owners
  • Signed-in users
  • Everyone
Owners Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
  • Invite by email
    Invitee

    This note has no invitees

  • Publish Note

    Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

    Your note will be visible on your profile and discoverable by anyone.
    Your note is now live.
    This note is visible on your profile and discoverable online.
    Everyone on the web can find and read all notes of this public team.
    See published notes
    Unpublish note
    Please check the box to agree to the Community Guidelines.
    View profile
    Engagement control
    Commenting
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    • Everyone
    Suggest edit
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    Emoji Reply
    Enable
    Import from Dropbox Google Drive Gist Clipboard
       owned this note    owned this note      
    Published Linked with GitHub
    Subscribed
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    Subscribe
    # Optimizer Demo **Try out**: :arrow_right: [Qwik Optimizer Playground](https://qwik-playground.builder.io/#rVjNcts2EH4VRIeKmiqU3elJkZR2XHucadxDkrYH29OBREjiGAJoEpSjYfnuXSxAEuCPknTig0UCu4v9/XbBYrSRERvNR/EhkakixYMg5CaluwMTaqpf9vj/Vmbm9flKAqWodp9vpXzCpzxjmuias5oVlq6P1YuQKt6ePjARsRQWSrJN5YGMf1nnMYelMJaz55f4afzmQTwI9hm12UiRKfJJ/iZ/TRKydA5fFETJSGZz2IUfUq4CVF0Kc8LcaBYElo6UE7JckUDTELLI2EbFUpANp1m2fBhpGpokD6OVIQCSW0ZBjuFeFvhTklmzf0djMbx7I6Ua5F7M7Pn4PpmANyZds60CZ62eElhhn9WcZCqNxc7xw53MBaxbNxjrK+LxGPwxwbB0HPZPJbPlssa2/eUKtVjM4KlejUWSq+qN1J4V7OW1pn4YNXsJpxu2lzrsQPH3nioiGIsyMI6sGYnA1rcuPc2VvJGbPGuWjpTnDBwLepbNqhTzJ3bKk2WBxizUKWFyaz25cpJhCv6iiqGB6K9abXQ901kLnq8SePE7O60lTSN8WwU6Wm0etP8vrRYwBighVDT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7IoUEF/sVkVtRQnXRLPWpm1odM5cghZjBI4xlKh5ysYl4WzrQTTeO0Gfto7OrGzCkfWoV7ipZYbkbXdEri6/JiuMtGWx9YfjzojcGZR77Oxx9kAPNX+VRRsYh1Nwuh3l/NZk/s5Wl3tpRHtRoIYzlGfTqm1LpwT035XmbGbgjintRtwLuxWte9loUzjQXFVK2YXoWDeMLVzE65uFgUFnSLe3CZSAPan6zAArcNqAqMzI6cMklIT52dxn7h9b0moI9+6stmHAgON87rDI7RZnkmcamBwrsOEBnzHAftlATTzUqwGiV5f2KFWrU5nRGNRVSg/bjorGM0EQY0LF5NWy4T2vV1ur9tXiy1pVr83tBpR71V39Vv/0lYXV5mv9cfPu/afrDx9DChKP7IsRqnXQ9ep3PhiHKOdj8i/8ojB8rG3THzX8OcVh9hP2/hGE3aO0aS0MnhpZOnt9YcYM4EOzgXVOzM1aX7jwIm3kwHLsxkfnghsWO6ohh5POX2Kyp5Rurddh6vqzThkThbe+/TZ2et60g0A1K/mTS++opKdeKk4GgAbypv8zTJU5LkqYg23nHk6fe1exx8F87Z8P/Iy1Zw19KepP2+auCOeOpqMD9K/tCT6wC5h/4R1mYLjkqhS8u9PL2QHuobAOKyJLYg7f4jGC+KED9te5iDjLgOIInRlUh7WL8CK8/Pn1T6PyPw==) :arrow_left: - Observe how code which is not written with explicit lazy loading can be converted into a lazy loadable code. - Optimizer has full control over how many chunks it creates. Chunk count and source code are fully independent. (You don't need to change source code to change where the lazy loaded bounderies are.) # FAQ What is it? > Qwik Optimizer is part of Qwik which breaks up your source code from large monolithic code base into many small lazy loadable chunks. The framework can than download the chunks on as-need-basis. But I can already do that with dynamic `import()`? > When using `import()` you (as a developer) must decide where the lazy loaded boundaries are. The benefit of Optimizer is that you can experiment with how code is broken up into chunks without changing any code. Also the framework creates lazy loaded boundaries everywhere. So no thinking is required to get the benefits. Why are so many files created? Aren't too many small requests worse? > The point of Optimizer is to allow you to experiment with different chunk sizes to find the optimal strategy. (For small applications, a single chunk would be preferable. ) Would having that many chunks create delay for first interaction? > To mitigate this, the application runtime starts downloading the chunks immediately in the background using a web-worker. This ensures that the code is downloaded early without negatively effecting the Google PageSpeed score. How do you know what the optimal load order is? > There is an optimal chunk strategy, but such strategy is not obvious until the application is built and its runtime is observed using actual users. When the Qwik application runs it collects the order in which the symbols are used. The order is then used to feed back into Optimizer so that the optimizer can collocate symbols which are needed together into the same chunk. This way, the optimizer can create optimal chunks without any changes to the source code. What is `qHook`? > Think of `qHook` as lazy loaded boundary. `qHook` is a marker which tells the optimizer that the code needs to be extracted into a top level lazy loadable entry point. A typical application can hove houndreths/thousends `qHooks` which gives great freedom to the optimizer on how to best break up the application. `qHook` get converted into a URL which gets embeded into the SSR HTML response which tells the Qwik framework where the code for a given listener should be downloaded from. Why can't variables within a listener access variables within the component's closure? > In order for the Optimizer to be able to pull the `qHook` code into a top level function which can be lazy loaded, the function can't close over most variables. Closing over the variables would prevent code from moving. `qHook` functions are allowed to close over symbols which are `import`ed or `export`ed only. The Qwik framework is written in such a way so that you don't find a need to close over these variables.

    Import from clipboard

    Paste your markdown or webpage here...

    Advanced permission required

    Your current role can only read. Ask the system administrator to acquire write and comment permission.

    This team is disabled

    Sorry, this team is disabled. You can't edit this note.

    This note is locked

    Sorry, only owner can edit this note.

    Reach the limit

    Sorry, you've reached the max length this note can be.
    Please reduce the content or divide it to more notes, thank you!

    Import from Gist

    Import from Snippet

    or

    Export to Snippet

    Are you sure?

    Do you really want to delete this note?
    All users will lose their connection.

    Create a note from template

    Create a note from template

    Oops...
    This template has been removed or transferred.
    Upgrade
    All
    • All
    • Team
    No template.

    Create a template

    Upgrade

    Delete template

    Do you really want to delete this template?
    Turn this template into a regular note and keep its content, versions, and comments.

    This page need refresh

    You have an incompatible client version.
    Refresh to update.
    New version available!
    See releases notes here
    Refresh to enjoy new features.
    Your user state has changed.
    Refresh to load new user state.

    Sign in

    Forgot password

    or

    By clicking below, you agree to our terms of service.

    Sign in via Facebook Sign in via Twitter Sign in via GitHub Sign in via Dropbox Sign in with Wallet
    Wallet ( )
    Connect another wallet

    New to HackMD? Sign up

    Help

    • English
    • 中文
    • Français
    • Deutsch
    • 日本語
    • Español
    • Català
    • Ελληνικά
    • Português
    • italiano
    • Türkçe
    • Русский
    • Nederlands
    • hrvatski jezik
    • język polski
    • Українська
    • हिन्दी
    • svenska
    • Esperanto
    • dansk

    Documents

    Help & Tutorial

    How to use Book mode

    Slide Example

    API Docs

    Edit in VSCode

    Install browser extension

    Contacts

    Feedback

    Discord

    Send us email

    Resources

    Releases

    Pricing

    Blog

    Policy

    Terms

    Privacy

    Cheatsheet

    Syntax Example Reference
    # Header Header 基本排版
    - Unordered List
    • Unordered List
    1. Ordered List
    1. Ordered List
    - [ ] Todo List
    • Todo List
    > Blockquote
    Blockquote
    **Bold font** Bold font
    *Italics font* Italics font
    ~~Strikethrough~~ Strikethrough
    19^th^ 19th
    H~2~O H2O
    ++Inserted text++ Inserted text
    ==Marked text== Marked text
    [link text](https:// "title") Link
    ![image alt](https:// "title") Image
    `Code` Code 在筆記中貼入程式碼
    ```javascript
    var i = 0;
    ```
    var i = 0;
    :smile: :smile: Emoji list
    {%youtube youtube_id %} Externals
    $L^aT_eX$ LaTeX
    :::info
    This is a alert area.
    :::

    This is a alert area.

    Versions and GitHub Sync
    Get Full History Access

    • Edit version name
    • Delete

    revision author avatar     named on  

    More Less

    Note content is identical to the latest version.
    Compare
      Choose a version
      No search result
      Version not found
    Sign in to link this note to GitHub
    Learn more
    This note is not linked with GitHub
     

    Feedback

    Submission failed, please try again

    Thanks for your support.

    On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

    Please give us some advice and help us improve HackMD.

     

    Thanks for your feedback

    Remove version name

    Do you want to remove this version name and description?

    Transfer ownership

    Transfer to
      Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

        Link with GitHub

        Please authorize HackMD on GitHub
        • Please sign in to GitHub and install the HackMD app on your GitHub repo.
        • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
        Learn more  Sign in to GitHub

        Push the note to GitHub Push to GitHub Pull a file from GitHub

          Authorize again
         

        Choose which file to push to

        Select repo
        Refresh Authorize more repos
        Select branch
        Select file
        Select branch
        Choose version(s) to push
        • Save a new version and push
        • Choose from existing versions
        Include title and tags
        Available push count

        Pull from GitHub

         
        File from GitHub
        File from HackMD

        GitHub Link Settings

        File linked

        Linked by
        File path
        Last synced branch
        Available push count

        Danger Zone

        Unlink
        You will no longer receive notification when GitHub file changes after unlink.

        Syncing

        Push failed

        Push successfully