Is dynamic import a slow type?
Is the dynamic import the reason, why my package can't reach the 100% score on jsr.io?
7 Replies
I wasn't able to find the answer to your question in the official Deno documentation. However, regarding your question about dynamic imports, they are not inherently slow, but they can introduce some latency compared to static imports due to the nature of being resolved at runtime. This could potentially affect various performance metrics, but it's not necessarily the reason why your package can't reach a 100% score on jsr.io.
As for your package's score on jsr.io, there could be many factors influencing it, such as code quality, test coverage, documentation, and more. Dynamic imports might be one of the factors if they are not used appropriately, but without more context, it's difficult to pinpoint the exact reason for the score.
Please note that this advice is not based on the Deno documentation, and I would advise you to double-check the accuracy of this advice and consider other factors that might be affecting your package's score on jsr.io.
@Deno AI Helper Should the command "deno lint" reveal all slow-types?
The
deno lint
command is designed to analyze your code for potential issues, including stylistic concerns, possible errors, and code that doesn't adhere to best practices. However, it does not specifically target performance issues such as "slow-types" or dynamically imported modules. Its primary focus is on code quality and maintainability, rather than performance profiling.
If you're concerned about performance, you might want to look into using a profiler or benchmarking tools to measure the actual impact of dynamic imports or other parts of your code that you suspect might be affecting performance.
Remember, this advice is not directly from the Deno documentation, so you should verify the accuracy and relevance to your specific situation. For the most accurate and up-to-date information on Deno's capabilities and tools, always refer to the official Deno documentation.I guess I'm blind 😅 I would really like to understand it. I don't see where slow-types should be in the code of my package.
Hi, I can confirm that you can get 100% even with unanalysable dynamic import... https://jsr.io/@jollytoad/store has 100%, but I always get that warning too. Here is the publish log for it... https://github.com/jollytoad/deno_storage_modules/actions/runs/9904294939/job/27361402691#step:4:134
GitHub
Publish · jollytoad/deno_storage_modules@856c739
Pluggable Storage Modules. Contribute to jollytoad/deno_storage_modules development by creating an account on GitHub.
... oh, and I didn't need to allow slow types either. So back to your original question: Dynamic imports do not appear to count as slow types.
@Mark G Thanks, and now I have also found the slow-type in my code.
There was a type that derived from an interface. Something like: