> I wonder how much the slow file load time is affecting the rest of
> the
> app startup process. Do we have plans to combine and minify our js
> and
> css files before we release v1? In addition to its localization
> files,
> the Gallery app (for example) loads 3 css files and 11 scripts. Is
> everything slow to load, or is it worse for the XHR requests that
> l10n.js does?
No, everything should be similarly slow.
The good news is that we're fairly good with parallelism so loading 10 files does mean 100ms times 10, rather ~200ms.
I'll combine css/js/l10n for an app and measure the difference early next week.
> Does the app:// protocol have any of the sort of 'only 2 connections
> at
> a time' throttling that we used to apply to http? That is, we're not
> artificially limiting the speed of our requests somehow, are we?
I don't know.
The numbers I see from performance.* API and XHR loading times suggest that synchronous loading is faster (40-60ms vs 90-150ms), but it blocks the main thread (obviously).
> Conversely, are we overloading our poor little CPU by throwing too
> many
> requests at it at once and causing it to thrash or something? (I'm
> just
> throwing these questions out there: I don't have any real
> understanding
> of how this under the hood stuff works...)
I'll investigate it more, but so far I don't see any impact of parallel file load on performance. I might have not tested enough files in parallel yet, but up to 10 files the parallelism of async file loading looks good.
> For localization, keep in mind that JavaScript now has robust binary
> data support. We use this to good effect for the word suggestions
> dictionaries, and could alter l10n.js to work with binary data if
> that
> would help. It might decrease file size and processing time.
File size is not an issue. The difference in load time between 18k file and 18byte file is almost zero.
Also, I/O is not an issue, the read perf is fairly good and exceeds what we observe by far.
I'd like to avoid turning to such methods.
> I assume that l10n.js uses querySelector() to find the element with
> the
> matching value of data-l10n-id. Has anyone looked at the performance
> of
> that? Would it make a performance difference if we used id (which
> is, I
> assume, very highly optimized) instead of data-l10n-id? Could we
> hack
> gecko to add an internal optimization for looking up data-l10n-id?
The perf. of this is fairly good. The whole DOM manipulation (search, inject, reflow) takes ~40ms for the whole document.
It feels (guessing here!) that the slowest we have is the time that it takes to access the file. Loading it is fast.
I tested if we close the ZIP file after each load (that's what Taras suggested) but it doesn't seem to be the case.
The high latency in file loading together with high number of files loaded brings high variance to all timings.
I suspect that it also affects pure index.html file load, since it is surprisingly slow as well. (empty template app on Unagi takes over 400ms to load).
So, my current plan is to test how much time can we shave by inlining resources into HTML files and update the bugs about file access latency next week.
Cheers,
g.