diff --git a/src/octoprint/plugins/gcodeviewer/static/js/viewer/reader.js b/src/octoprint/plugins/gcodeviewer/static/js/viewer/reader.js index 507976f8a..8c7396a86 100644 --- a/src/octoprint/plugins/gcodeviewer/static/js/viewer/reader.js +++ b/src/octoprint/plugins/gcodeviewer/static/js/viewer/reader.js @@ -154,7 +154,8 @@ GCODE.gCodeReader = (function () { this.clear(); var totalSize = reader.target.result.length; - lines = reader.target.result.split(/[\r\n]/g); + // With a regex split below as previous, memory usage is huge & takes longer. + lines = reader.target.result.replace("\r\n", "\n").split("\n"); reader.target.result = null; prepareGCode(totalSize);