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

PoC loading of specific parts of core-js #1732

Closed
wants to merge 2 commits into from
Closed

Conversation

mstoykov
Copy link
Contributor

@mstoykov mstoykov commented Nov 19, 2020

This is a very WIP alternative to #1714 that actually loads specific files from it and it is obvious what is loaded in the code instead of needing to know how we build the shim file.

TODO:

  • Discuss if this is at all useful ... The main benefit is that if tomorrow we decide to drop es6.promise.js we just drop it from the index.js and then drop it dependencies.
  • Better code - again this is PoC - I intend for there to be a test that does the checking if some files are not needed for example, but also very likely to refactor the whole code ;). Also it will be nice if the source codes are compiled only once.
  • Decide if we want to drop even more corejs? The nice thing here is that you also can see which files are imported as dependencies
  • Make some script that does the git checkout + copy of the concrete files we need and runs go generate to embed them, without actually adding the files to the repo. This will save some space

Problems:

  • This actually generates a bigger binary, and the rice-box.go is bigger as we have slightly more code actually.
  • It is probably slightly slower as it needs to require some stuff, haven't benchmarked it yet.

@mstoykov mstoykov requested review from imiric, simskij and na-- November 19, 2020 15:20
@codecov-io
Copy link

codecov-io commented Nov 19, 2020

Codecov Report

Merging #1732 (ff2e0c8) into master (6081e6a) will increase coverage by 1.40%.
The diff coverage is 83.90%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1732      +/-   ##
==========================================
+ Coverage   71.49%   72.90%   +1.40%     
==========================================
  Files         178      178              
  Lines       13727    14518     +791     
==========================================
+ Hits         9814    10584     +770     
- Misses       3301     3317      +16     
- Partials      612      617       +5     
Flag Coverage Δ
ubuntu 72.88% <83.90%> (+1.44%) ⬆️
windows 71.52% <83.90%> (+1.48%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
js/bundle.go 90.54% <0.00%> (ø)
js/lib/rice-box.go 100.00% <ø> (ø)
js/lib/lib.go 77.65% <84.88%> (-22.35%) ⬇️
lib/executor/vu_handle.go 93.33% <0.00%> (-1.91%) ⬇️
lib/testutils/minirunner/minirunner.go 86.04% <0.00%> (+4.65%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 6081e6a...ff2e0c8. Read the comment docs.

@mstoykov
Copy link
Contributor Author

mstoykov commented Nov 20, 2020

Some performance running

import http from "k6/http";
import { sleep } from "k6";

export let options = {
    discardResponseBodies: true,
}
export default function() {
    http.get("https://httpbin.test.loadimpact.com/get");
    sleep(Math.random() * 2 + 3);
}

with -vus 5000 --duration 60s main.js -v --no-thresholds --no-summary

version iterations mem usage CPU usage time to initialize VUs run time
6081e6a 64391 17066648 440% ~29.5s 1:54.10
stripCoreJs 64430 8201408 345% ~10.45s 1:39.45
ddf9ecd 65892 6659656 386% ~10.8s 1:29.55
1d0812c 65229 5189428 314% ~10.07 1:37.07
6081e6a + base 62436 2607824 333% ~2.1s 1:14.58

The first is ( the current ) master, stripCoreJs is #1714 rebased on it, and the last is the current last commit here.

  • 6081e6a + base is the master + compatibility-mode=base + a script changes that can work with it .
  • around 1GB is added to the mem usage, during the 1 minute of execution.

The numbers move a little bit, but are in the same magnitude.

I don't know why stripCoreJS uses more memory, maybe I dropped something additional or web packing adds a lot of additional stuff?

@simskij
Copy link
Contributor

simskij commented Nov 20, 2020

Yeah, webpack adds some code, but it should be fairly insignificant in this case. I need to take this branch for a drive before having anything useful to say. Will get back to you! Good job nonetheless! 👍

@mstoykov mstoykov mentioned this pull request Dec 2, 2020
@mstoykov
Copy link
Contributor Author

close in favor of #1772

@mstoykov mstoykov closed this Dec 15, 2020
@mstoykov mstoykov deleted the corejsRework branch January 8, 2021 12:42
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.

3 participants