quantizor / markdown-to-jsx

🏭 The most lightweight, customizable React markdown component.
https://markdown-to-jsx.quantizor.dev/
MIT License
2.04k stars 177 forks source link

Base64 encoded images saved as a data url slows down parsing a lot. #527

Open boonya opened 1 year ago

boonya commented 1 year ago

I have a payload which freeze a tab of browser for a looong time.

**Heavy payload**\n\n![color-palette.png](data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAABGkAAAEMCAYAAAB3FevlAAAAAX...)\n\n*... the end of it*

As you can see this is a png image saved as base 64 encoded data url. The size of the image is 75kb, so I had to trim it to post the issue here. But the total size of payload seems 98.5kB.

Here is how performance tab looks like.

image

Seems it spend a loot of processing time to some regexp.

I just wonder is there a way to improve it somehow?

My env specs, just in case.

P.S. Is there a benchmarks that may show me how big payload the library can process in an adequate time frame?

quantizor commented 7 months ago

There's likely some optimization potential here, haven't spent much time on images/links in a while

pf-costa commented 3 weeks ago

Hey @quantizor can you provide an update? I'm supper happy with the library, however for me this a dealbreaker 😢