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

JSX DOM render extremely slow #3201

Closed
luaVolk opened this issue Jul 28, 2024 · 1 comment · Fixed by #3205
Closed

JSX DOM render extremely slow #3201

luaVolk opened this issue Jul 28, 2024 · 1 comment · Fixed by #3205
Labels

Comments

@luaVolk
Copy link

luaVolk commented Jul 28, 2024

What version of Hono are you using?

4.5.2

What runtime/platform is your app running on?

Bun

What steps can reproduce the bug?

import { render } from "hono/jsx/dom";

const root = document.getElementById("root");

render(
	<>
		<div><span></span></div>
		<div><span></span></div>
		<div><span></span></div>
		<div><span></span></div>
		<div><span></span></div>
		<div><span></span></div>
		<div><span></span></div>
		<div><span></span></div>
		<div><span></span></div>
		<div><span></span></div>
		<div><span></span></div>
		<div><span></span></div>
		<div><span></span></div>
		<div><span></span></div>
		<div><span></span></div>
		<div><span></span></div>
		<div><span></span></div>
		<div><span></span></div>
		<div><span></span></div>
		<div><span></span></div>
		<div><span></span></div>
		<div><span></span></div>
		<div><span></span></div>
		<div><span></span></div>
		<div><span></span></div>
		<div><span></span></div>
		<div><span></span></div>
		<div><span></span></div>
	</>
, root);

What is the expected behavior?

Rendering something of that complexity should be immediate

What do you see instead?

It takes about 12 seconds to render the code above. Twice as much if I add one more <div><span></span></div>

Additional information

The time it takes for the render function to complete increases exponentially with the amount of nodes.
From what I gathered it seems to get stuck in the findInsertBefore function

@usualoma
Copy link
Member

Hi @luaVolk, Thanks for the report.
I am now investigating!

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