Skip to content

There can be only one API layer - #2080

Merged
niik merged 21 commits into
masterfrom
there-can-be-only-one-api-layer
Jun 22, 2017
Merged

niik merged 21 commits into
masterfrom
there-can-be-only-one-api-layer

Conversation

@joshaber

@joshaber joshaber commented Jun 21, 2017 •

Copy link
Copy Markdown
Contributor

I was looking into our bundle size and noticed that Octokat and its dependencies add quite a bit of bulk to our bundle. Octokat was extremely helpful in getting off the ground, but now it's time for us to fly on our own. Given that we already implement some of our own API requests, and issues like #2017, I think we should standardize on doing our own API requests.

The advantages of this:

  1. Smaller bundle.
  2. Uniform error handling.
  3. Guaranteed to use Chromium's network stack.

More concretely on (1), our renderer bundle size on master:

screen shot 2017-06-21 at 12 36 08 pm

Our renderer bundle size on this branch:

screen shot 2017-06-21 at 12 38 46 pm

That's a drop of ~535kb 🤘 This directly translates into faster startups since it's less JS for V8 to parse at launch.

Timings on master after a few launches:

screen shot 2017-06-21 at 1 01 27 pm

Timings on this branch after a few launches:

screen shot 2017-06-21 at 12 55 51 pm

Fixes #2017
Fixes #2064
Fixes #963
Supersedes #1937

To test:

  • Get a repository.
  • Fetch the user.
  • Fetch emails.
  • Create a new authorization.
  • Get OAuth token.
  • Create a new repository.
  • Create a new repository with the same name as an existing one.
  • Search for users.
  • Get orgs.
  • Get a commit.
  • Get fetch interval.
  • Get issues.
  • Get mentionables.

@joshaber

Copy link
Copy Markdown
Contributor Author

This is ready 🙏 Note that the api.ts diff is being collapsed by default 😒

@joshaber joshaber added the ready-for-review Pull Requests that are ready to be reviewed by the maintainers label Jun 21, 2017
@niik niik self-assigned this Jun 22, 2017

@niik niik left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is some top notch work @joshaber, really happy with it!

@niik
niik merged commit 04c4074 into master Jun 22, 2017
@niik
niik deleted the there-can-be-only-one-api-layer branch June 22, 2017 07:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready-for-review Pull Requests that are ready to be reviewed by the maintainers

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants