Unverified Commit 8dc46705 authored by Oleg Zuev's avatar Oleg Zuev Committed by GitHub

Replace regexp to plain string for optimization render HTML (#33306)

## Bug

Line `const [renderTargetPrefix, renderTargetSuffix] = documentHTML.split(*)` with RegExp almost 80 times slower than a plain string.

Before:
![telegram-cloud-photo-size-2-5409140542421448593-y](https://user-images.githubusercontent.com/22259080/149506024-84365840-5b0f-481f-b05f-1381d839c579.jpg)


After:
![telegram-cloud-photo-size-2-5409140542421448594-y](https://user-images.githubusercontent.com/22259080/149506036-0df69ae7-e265-40da-a865-73c84496aa58.jpg)
parent 2c9c8f76
......@@ -1431,7 +1431,7 @@ export async function renderToHTML(
}
const [renderTargetPrefix, renderTargetSuffix] = documentHTML.split(
/<next-js-internal-body-render-target><\/next-js-internal-body-render-target>/
'<next-js-internal-body-render-target></next-js-internal-body-render-target>'
)
const prefix: Array<string> = []
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment