Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #31399

Re: Parsing javascript file off the main thread

Newsgroups comp.lang.javascript
Date 2016-09-18 10:55 -0700
References <fa9f1a4a-1f09-4ff0-9f23-d249dea58a52@googlegroups.com>
Message-ID <ecf77057-47fb-4f2f-9dac-4f89b78a1ae3@googlegroups.com> (permalink)
Subject Re: Parsing javascript file off the main thread
From "Michael Haufe (TNO)" <tno@thenewobjective.com>

Show all headers | View raw


On Friday, September 16, 2016 at 8:30:30 AM UTC-5, Georg Kothmeier wrote:
> Hey!
> 
> I wonder if it is possible to parse a javascript file off the main thread. If it is possible, is it possible across all modern browsers?
> 
> Our use-case is a 25mb (6 mb gzipped) Unity-asm.js-export of a game. If the Unity-asm.js-source is parsed the whole browser freezes. Which is not a nice UX. The loading and parsing wouldn't be a problem because we do it in background but the freezing of the whole UI is a big problem.

My first question is where in the HTML document the <script /> is referenced.
If it's in the <head> tag, then that's one major problem right there.

> I know Unity is not really "web-ready" but we have to deal with it because we have a quite huge code base written in Unity. As a technical detail, Unity loads the 25mb JavaScript via a blob: URL. Don't know if this makes a difference for my question.

Are you referring to the following?

<script src="data:text/javascript,alert('hi');" type="text/javascript"></script>

> Are there any ways around? Would it also be possible to cache the byte code of the parsed script somehow?
> 
> Thanks a lot for your ideas

Modern browsers are probably already doing this, depending on the details of how you're including the script in your application.

Back to comp.lang.javascript | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Parsing javascript file off the main thread georgkothmeier@gmail.com - 2016-09-16 06:29 -0700
  Re: Parsing javascript file off the main thread "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2016-09-16 17:43 +0200
    Re: Parsing javascript file off the main thread Georg Kothmeier <georgkothmeier@gmail.com> - 2016-09-16 16:16 -0700
    Re: Parsing javascript file off the main thread Georg Kothmeier <georgkothmeier@gmail.com> - 2016-09-16 16:18 -0700
      Re: Parsing javascript file off the main thread "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2016-09-17 10:47 +0200
  Re: Parsing javascript file off the main thread "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2016-09-18 10:55 -0700
    Re: Parsing javascript file off the main thread Georg Kothmeier <georgkothmeier@gmail.com> - 2016-09-19 00:28 -0700
      Re: Parsing javascript file off the main thread "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2016-09-19 08:15 -0700
        Re: Parsing javascript file off the main thread Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2016-09-19 19:46 +0200
          Re: Parsing javascript file off the main thread "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2016-09-19 11:00 -0700
            Re: Parsing javascript file off the main thread Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2016-09-19 20:42 +0200
              Re: Parsing javascript file off the main thread "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2016-09-19 11:53 -0700
                Re: Parsing javascript file off the main thread Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2016-09-20 00:01 +0200
                Re: Parsing javascript file off the main thread "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2016-09-20 12:02 -0700
                Re: Parsing javascript file off the main thread Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2016-09-20 21:26 +0200
                Re: Parsing javascript file off the main thread "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2016-09-20 17:38 -0700
                Re: Parsing javascript file off the main thread Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2016-09-22 06:46 +0200
                Re: Parsing javascript file off the main thread "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2016-09-22 05:53 -0700
                Re: Parsing javascript file off the main thread Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2016-09-23 02:42 +0200
                Re: Parsing javascript file off the main thread "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2016-09-23 09:29 -0700
                Re: Parsing javascript file off the main thread "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2016-09-20 12:00 -0700
                Re: Parsing javascript file off the main thread Scott Sauyet <scott@sauyet.com> - 2016-09-21 02:24 +0000

csiph-web