Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix and refactor the benchmark suite #8066

Merged
merged 16 commits into from
Mar 23, 2019
Merged

Fix and refactor the benchmark suite #8066

merged 16 commits into from
Mar 23, 2019

Conversation

mourner
Copy link
Member

@mourner mourner commented Mar 22, 2019

Fixes benchmarks builds, closes #8064. Gets the uploaded build down from 10MB to 719k.

  • Fix failing benchmark builds on master
  • Make source maps external to avoid huge benchmark builds (previously, 10MB)
  • Turn on production mode for benchmark builds so that they're minified/unasserted (had to switch to explicit benchmark names for that because class names are mangled in minified build)
  • Remove broken sharing button (that we have no replacement for, remove anonymous gist dependency from benchmarks  #6224)
  • Simplify benchmark build configs and watch scripts
  • Introduce separate benchmark_view build again so that React/d3 and UI logic isn't built into benchmark builds
  • DRY up code between styles and versions benchmarks

@mourner mourner changed the title Benchmarks build fixes Fix and refactor the benchmark suite Mar 22, 2019
Copy link
Member

@tristen tristen left a comment

Choose a reason for hiding this comment

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

Tested locally and both versions/styles LGTM 🍭

</head>

<body>
<div id="benchmarks"></div>
<script src="/bench/styles/benchmarks_generated.js"></script>
<script src="/bench/benchmarks_view_generated.js"></script>
<script>
window.Benchmarks.run(benchmarks);
Copy link
Member

Choose a reason for hiding this comment

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

Is the benchmarks variable provided by benchmarks_view_generated.js?

Copy link
Member

Choose a reason for hiding this comment

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

Trying to think through any consequences of calling Benchmark.run for my submodule use case of the benchmark suite. I think its probably fine but I'm just curious the reasoning here.

Copy link
Member Author

Choose a reason for hiding this comment

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

@tristen it's provided by index.html and benchmarks.js of each respective benchmark. Styles and versions benchmarks need different treatment here — versions benchmarks group by name in a global variable because versions are ran as separate builds (and we need to keep compat with previous benchmark builds), and styles benchmarks build the benchmarks array in the build itself (because we don't upload them, and they need additional metadata like location).

@@ -1,12 +1,89 @@
import React from 'react';
import ReactDOM from 'react-dom';
import * as d3 from 'd3';
import Axis from './lib/axis';
Copy link
Member

Choose a reason for hiding this comment

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

I kind of wish all the React components weren't defined in one script but 🤷‍♂️

Copy link
Member Author

Choose a reason for hiding this comment

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

I thought it would be nice to put all UI in one file, so that there's clear separation — lib only contains logic that gets insider the different benchmarks builds, and bencharks_view encapsulates all the view logic. As a follow-up, we could split the view components again in a separate folder (e.g. view or components).

Copy link
Contributor

Choose a reason for hiding this comment

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

Splitting up the components may be a good opportunity to remove React too. Could be easier to do if the UI is split into smaller, discrete pieces

Copy link
Member Author

Choose a reason for hiding this comment

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

Sounds good! Let's follow up with splitting components in a different PR (don't want to blow up the scope of this one too much).

@ryanhamley
Copy link
Contributor

ryanhamley commented Mar 22, 2019

The styles folder is missing a rollup config and the style benchmarks are currently only running against master

@mourner
Copy link
Member Author

mourner commented Mar 22, 2019

The styles folder is missing a rollup config

All the configs are centralized in one file (bench/rollup_config_benchmarks.js) for less duplication. I left the config file in versions (although it reuses the one above) so that CI can build it without building other benchmarks. See this commit ba571a0

@mourner mourner merged commit de7f77d into master Mar 23, 2019
@mourner mourner deleted the fix-benchmarks-build branch March 23, 2019 14:05
@mourner
Copy link
Member Author

mourner commented Mar 23, 2019

Here's an example timing of loading a benchmark without cache — the first line is v0.53.1, the second is master from S3 (after merging this PR), and the third is the local bench build. It's smaller than S3 master because gzip is turned off for S3 bench uploads for some reason. We should probably look into that some time.

image

mourner added a commit that referenced this pull request Apr 25, 2019
* release-liquid: (84 commits)
  v0.54.0 (take two) (#8184)
  Fix disappearing controls in Safari 12+ (#8193) (#8194)
  [docs] token refactor in docs-page-shell (#8174) (#8181)
  v0.54.0-beta.2 (#8166)
  Bugfix - removeFeatureState fails with target.id === 0 (#8150) (#8164)
  update one more frame after canvas source paused (#8130) (#8163)
  move docs dependencies to dev (#8121) (#8129)
  v0.54.0 (#8115)
  CP removeFeatureState fix (#8090)
  v0.54.0-beta.1 (#8084)
  Allow setStyle diff by default with localIdeographFontFamily on (#8081)
  Upgrade various (mostly dev) deps, downgrade GL (#8078)
  Fix default marker positioning (#8074)
  Use @mapbox/gazetteer for benchmark coordinates (#8063)
  bump react-dom to v16.3.3 to fix minor vulnerability warning
  Fix and refactor the benchmark suite (#8066)
  Add max width for popups (#7906)
  Extrusions: Do not try to triangulate non-polygon type features (#7685)
  docs fixes after the merge
  limit flow max_workers and upgrade to v0.95.1 (#8061)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Fix broken benchmarks build (or drop React)
3 participants