-
-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Build time grows with every render #33
Comments
How are you fetching your data? I will note that we use a version of this in I will also note, that i don't have multiple Markdown components on the same page, so i'm not sure exactly on that note, but it sounds like something you could remedy if you could merge these entries together in a way that would make sense(if its possible to only parse and render from the |
Its just using Marked.js to parse the markdown(this can be used both Client-side and Server-side), there is not really anything fancy for this one... (no vite plugins or anything that should be doing adding any delay...) Yeah That is a weird delay that i've never seen in all of my projects that are using |
@Adammatthiesen I think I found the culprit, although I'm not sure what is the best solution: https://github.com/natemoo-re/astro-remote/blob/main/packages/astro-remote/lib/utils.ts#L112
However, I'm not sure what should be the solution for this, since the plugin and components can vary from one |
@Adammatthiesen Instead of: marked.use(markedSmartypants(), markedFootnote(), ...markedExtenstion, {
gfm: true,
renderer,
})
const content = await instance.parse(dedent(input)) it could do this: const instance = new Marked(markedSmartypants(), markedFootnote(), ...markedExtenstion, {
gfm: true,
renderer,
})
const content = await instance.parse(dedent(input)) what do you think? if you think is fine I can create a PR UPDATE: forgot to mention, this change fixes the problem I was facing |
@natemoo-re This could be a good chance to add an Optional Integration with a Global Config object (and a Markdown component for this config) to use for this type of configuration. @codeserk I'm not sure if changing the main Component utility would be the best plan, as |
@Adammatthiesen aren't side-effects happening with the current utils ? Since it uses the global |
Use new instance of marked instead of the global one https://marked.js.org/using_advanced
@Adammatthiesen I've created a PR with the proposal solution for the problem I mentioned, |
Hi. Early report of a huge build performance hit on a project of mine. I tracked the issue down to version 0.3 of this package. Version 0.2.4 builds my 700 pages in ~50s on my machine, while v3 keeps going forever. I tried applying @codeserk 's PR #35 and it fixes my issue. Let me know if I can test something on my side to help. |
Hello,
I'm using this lib to render MD/MDX from remote sources and it works quite well.
However, I noticed that the build time grows with every render. I have a page that uses the
Markdown
component a few time and it goes crazy in dev mode:The first render is fast-ish
100ms
but the time keeps growing with every refresh of the page
300ms
-600ms
-1200ms
at some point it's just too slow and the only solution is to restart the dev server.
This behavior also happens when the app is built and I start the server (
npm run start
).I'm opening the issue in case this rings a bell and/or you know the possible cause somehow, I'll try to debug it better and come up with a PR if I find the cause
Thanks !
The text was updated successfully, but these errors were encountered: