Skip to content
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

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

Open
boonya opened this issue Nov 22, 2023 · 1 comment
Open

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

boonya opened this issue Nov 22, 2023 · 1 comment
Assignees

Comments

@boonya
Copy link

boonya commented Nov 22, 2023

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.

  • markdown-to-jsx@7.3.2
  • 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?

@quantizor quantizor self-assigned this Apr 19, 2024
@quantizor
Copy link
Owner

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants