markdown-to-jsx icon indicating copy to clipboard operation
markdown-to-jsx copied to clipboard

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

Open boonya opened this issue 8 months ago • 1 comments

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.

  • [email protected]
  • Google Chrome 119.0.6045.159 (arm64)
  • MacOS Sonoma 14.1.1
  • MacBook Pro 13-inch, M1, 2020

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

boonya avatar Nov 22 '23 12:11 boonya

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

quantizor avatar Apr 19 '24 04:04 quantizor