I can't reproduce the problem, so it may be caused by an experiment that is enabled for random installations of Chrome, something similar to the old one for HTML parser yielding that inserted a GPU paint frame every 50 tags or so. That particular experiment was disabled for local files and extensions, so maybe now there's something else, but try this workaround anyway: "hide" the html inside a <template> tag in <head> + load the main script in <body> + add the contents of the template explicitly.
<head>
<template>
.........the entire contents of the current body
</template>
<head>
<body>
<script src=script.js></script>
</body>
script.js:
document.body.appendChild(document.querySelector('template').content);
.........................