Browser-laptop: Improve startup time

Created on 7 Aug 2016  路  36Comments  路  Source: brave/browser-laptop

Using console.time and console.timeEnd figure out why our startup time isn't ideal and find ways to improve it by lazily loading the slow things. Or see what we can wait until a few seconds into the app is started to init.

fixed-with-brave-core hackathon initiativperf perf prioritP2 project-tracking

All 36 comments

+1 from #5677.

UI suggestion: #5820

There is still the problem of Brave's slow startup that doesn't seem to have been fixed since milestone 1.1.0. Its becoming my favorite browser, I'm I'm finding myself opening Firefox or Edge while waiting for it to start. And by the time Brave starts the other mentioned browser has already open and reached the the site I needed. The current version I am now using is
Name Version
Brave 0.12.15
Muon 1.4.31
libchromiumcontent 53.0.2785.143
V8 5.3.332.47
Node.js 6.5.0
Update Channel dev
os.platform win32
os.release 10.0.14393
os.arch x64

have been fixed since milestone 1.1.0.

Because it's the milestone in a future.

This is still an issue. Do we know which release is going to fix this ?

@Miyurz this is something we'd definitely love to improve. Unfortunately, I can't give a date. You can track some of our performance issues (including this one) with https://github.com/brave/browser-laptop/issues/9311

Startup time research

1) with a lot of bookmarks 75k, one window one tab (new tab), default settings

Measurements done with reducers timers

To see the skeleton of a browser (page is still not loaded) it takes ~12 seconds to load

  • [ ] ledger.js (APP_SET_STATE) adds ~300ms
  • [ ] urlBarSuggestionsReducer.js (APP_SET_STATE) adds ~500ms
  • [ ] menu.js (APP_SET_STATE) adds ~2200ms

Measurements done with dev tool profiler
bookmarks

2) 15 windows with 10 new tabs on each, no bookmarks, default settings

Measurements done with reducers timers

To load all 15 windows and to see new tab page on each of it takes +42 seconds to load, 32 seconds to only see url bar without tabs. Startup is not that bad, it only takes ~2 second to display white window.

  • [ ] tabsReducer (APP_SET_STATE) add ~300ms

Measurements done with dev tool profiler
windows

3) Ledger enabled with 10000 transactions and 10000 publishers in synopsis

TODO


Cpu profiles exports for windows and bookmarks
Archive.zip

Update 30.08.2017

1) more detailed research

init: 12839.760ms (stopped when INITIALIZE_WINDOW is called)
render: 212.398ms (triggered when INITIALIZE_WINDOW is called)
all: 13052.465ms

SessionStore.loadAppState() takes ~1600ms
1: 32.436ms (file read)
2: 503.799ms (json parse)
3: 0.357ms
4: 0.527ms
5: 1072.723ms (make immutable)
6: 2.379ms
7: 3.735ms

appActions.setState takes ~ 3000ms
flash: 0.131ms
tabs: 0.327ms
bookmarks: 0.112ms
window: 0.196ms
sync: 0.376ms
suggestions: 449.165ms
pass: 0.113ms
spell: 0.068ms
messageBox: 0.109ms
ledger: 530.967ms
menu: 1936.364ms
store: 19.378ms

siteSuggestions.init takes 3000-4000 ms

Update 31.08.2017

1) more detailed research

ledger initial time takes 70ms (CPU-20170831T112539.cpuprofile.zip)
image

ledger init call takes 600ms
image

bloodhound init takes 600ms
image

Yessss. Please make it a higher priority! People start flocking away from Chrome and Mozilla right now in relation to censorship and privacy issues. Brave is such an obvious choice. I've checked it out and it suits me just fine, but a 20 second startup just to get an empty browser is a no go for somebody like me and many others. If you start a browser once a day it's not a biggie, but if it's 15 times a day it becomes a serious issue. It's the only thing that keeps me from using it as my primary browser.

Converted this issue to an Epic so we can start tracking specific issues inside this one.

Per @zentagonist request, I'm typing down what we could cover with this. The plan is to split this issue most we can so it's measurable.

  • Remove task-specific calls for unneeded features in start-up time (does ledger needs to be called at init time?)
  • Lazy-load task-specific calls likely to be used first once the app is ready (such as suggestions and bookmarks)
  • Improve the initial loading experience. Measure with metrics for first paint and first meaningful paint.
  • If all else fails, i.e. a feature that could not be removed at first content load (like punycode?), reduce call cost for long task operations by replacing them with faster methods

@NejcZdovc please add notes here based on your research if there's something more we should cover. Plan is to split this into several sub-tasks so that's achievable and not stale based on many issues to be covered

also related to this issue #8128

Any update on the status of the fix?

Great perf win by @ayumi which needs some additional work before we can accept it (if anyone is interested in checking out the hooks): https://github.com/brave/browser-laptop/pull/11962

+1

This should be fixed with brave-core but still needs tracking on brave-core once brave specific features are implemented.

Latest release from 14 days ago takes ca. 20 seconds to load on a modern Windows notebook with SSD. Chrome takes around 1 second on the same machine. Has this been fixed in brave-core yet?

Brave: 0.23.79
V8: 6.8.275.24
rev: 51b49051a779f0db94fbcfd0df5faca781299ea0
Muon: 8.0.7
OS Release: 6.3.9600
Update Channel: Release
OS Architecture: x64
OS Platform: Microsoft Windows
Node.js: 7.9.0
Brave Sync: v1.4.2
libchromiumcontent: 68.0.3440.84

@nisc did you want to give it a shot? You can try one of our releases available here:
https://github.com/brave/brave-browser/releases

I'm able to open 0.54.0 on Windows in just under 3 seconds

Closing as I believe this is addressed with brave-core

@bsclifton 0.54.1 reduces startup time by ~80% to ~4 seconds on my machine. Much better than the >20 seconds in the stable release. Still not as fast as Chrome. But fast enough to be useful in production. This can stay closed.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jonathansampson picture jonathansampson  路  3Comments

jkup picture jkup  路  3Comments

briannyeko picture briannyeko  路  3Comments

bbondy picture bbondy  路  3Comments

stevespringett picture stevespringett  路  3Comments