1

After reading the question on how to build a complex web_ui application, I'm wondering if it will be performant enough.

I'm building a fairly large web application and am wondering if I should split up the main parts or if I can safely serve everything on one page (assuming that I don't mind that the user has to download a pretty big junk of .dart code).

Community
  • 1
  • 1
enyo
  • 16,269
  • 9
  • 56
  • 73
  • 1
    We have a production app that is 2.8 MB. Minified and gzip'd it's 189 kB and cached forever on the client. We have 66 web components and some other code as well. – Kai Sellgren Jun 11 '13 at 11:31
  • @KaiSellgren are your dart files combined in some way or does the browser have to download all 66 components separately? – enyo Jun 11 '13 at 17:29
  • I was talking about the dart2js output (JavaScript file). We are not combining .dart files for the moment (I know there's `dart2js --output-type=dart` or something for it but hasn't been important for us yet). So, in case of dart2js we are of course just downloading all at once since it's so small (189 kB). Later we might split. – Kai Sellgren Jun 11 '13 at 20:34

1 Answers1

1

It is usually considered best practice to split up your code once it reaches a certain size (that size depends on your target audience, your servers etc.).

Dart2js supports lazy loading of libraries so that you load an initial app chunk on page load and then load separate chunks through AJAX requests as they are needed. This will save you bandwidth and speed up page load time.

You can start with serving a single file, but if you expect that will not be performant enough, I would build lazy loading into the app from the start.

Note: at this time there are limitations on how many files can be lazy loaded: https://code.google.com/p/dart/issues/detail?id=3940

Pixel Elephant
  • 20,649
  • 9
  • 66
  • 83