Compiler Speed - Flowbite Svelte
Learn how you can manage and improve the Svelte compilation speed when using the Flowbite Svelte library by checking out this tutorial
If your Svelte app only requires a few components, it’s recommended that you import them directly. Doing so can help optimize compilation speed and improve performance by reducing the amount of code that needs to be processed during compilation. Since version 0.34.1, it’s now possible to import individual components.
import Alert from 'flowbite-svelte/Alert.svelte'
Speed comparisons #
Files | Time | Avg |
---|---|---|
1 | 3.3ms | 3.3ms |
2 | 9.0ms | 4.5ms |
7 | 20.7ms | 3.0ms |
7 | 60.6ms | 8.7ms |
The above table shows examples from using import Alert from 'flowbite-svelte/Alert.svelte'
. Compare these numbers to the following table where using normal import.
Files | Time | Avg |
---|---|---|
151 | 1.10s | 7.3ms |
154 | 0.40s | 2.6ms |
151 | 1.04s | 6.9ms |
154 | 1.32s | 8.8ms |