-
Notifications
You must be signed in to change notification settings - Fork 675
generate_images: add puppeteer(pptr) backend #1268
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
Conversation
- jsdom: run Bravura and other font to ensure backcompat filename.
(for recent flow.html dom tree).
… in parallel. - Moved the implementation of child process management from each backend to generate_images.js.
- jsdom: fix old build support.
ex: npm run get:releases 3.0.9 then load flow.html?module=Beam&ver=releases/3.0.9
This is still a draft. |
ready to review. |
And puppeteer is back! This is great @h-sug1no. :-) Just a minor comment. |
tools/generate_images.js
Outdated
|
||
const usage = () => { | ||
log('Usage:'); | ||
log(' node generate_images.js ver imageDir [--backends=<backends>] [--parallel=<jobs>]'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we make this look like:
Usage: node generate_images.js <version> /path/to/image/dir [options...]
Options:
--backends=(all|jsdom|pptr) : Specify which backend(s) to run.
--parallel=<num> : Number of parallel processes. Defaults to the number of CPUs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
like this? 5d26dff
$ node ./tools/generate_images.js
Usage: node generate_images.js <version> /path/to/image/dir [options...]
Options:
--backends=(all|jsdom|pptr) : Specify which backend(s) to run.
--parallel=<num> : Number of parallel processes. Defaults to the number of CPUs.
Hi, thanks for this PR! I am excited to try it out when I have some time. Unfortunately due to the holidays, I won't be able to test & review this until January 2nd or 3rd. Maybe someone else will review it before I get around to it, but I just wanted to let you know my availability. :-) |
I am also wishing to see if it detects the changes in #1262 that the current visual regression system does not detect. :) |
# Conflicts: # package.json # tests/flow.html
use ver/cjs if available as follows:
svg diff is detected as follows ( #1241 ) : OK |
ready for review now. |
@@ -90,6 +90,11 @@ if (!global.$) { | |||
|
|||
export type TestFunction = (options: TestOptions, contextBuilder: ContextBuilder) => void; | |||
|
|||
export type RunOptions = { | |||
jobs: number; | |||
job: number; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a bit confusing, maybe numJobs
and jobIndex
? (sorry, I know it's all over the code, but it makes it hard to tell what it's for.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- numJobs is length of VexFlowTests.tests.
- to map tests to available cpus split tests into jobs.
- Since flow.html contains multiple canvases and svgs, and since the number of tests is likely to increase in the future, we will divide it into 10 tests each for fear of exhausting resources. : https://github.com/h-sug1no/vexflow/blob/0a8eec238857cf52d82cc711a9fb61aa230cf756/tools/generate_images.js#L120
- If split the test too much, the initialization cost of pptr/chrome will increase and the total performance will be worse. 10 is not such a bad value.
- Since flow.html contains multiple canvases and svgs, and since the number of tests is likely to increase in the future, we will divide it into 10 tests each for fear of exhausting resources. : https://github.com/h-sug1no/vexflow/blob/0a8eec238857cf52d82cc711a9fb61aa230cf756/tools/generate_images.js#L120
- to map tests to available cpus split tests into jobs.
- VexFlowTests.run() interprets jobs and job arguments as follows
- https://github.com/h-sug1no/vexflow/blob/0a8eec238857cf52d82cc711a9fb61aa230cf756/tests/vexflow_test_helpers.ts#L160
- This is the implementation because we believe that tests should not depend on the order of execution.
- https://github.com/h-sug1no/vexflow/blob/0a8eec238857cf52d82cc711a9fb61aa230cf756/tests/vexflow_test_helpers.ts#L160
I hope that explains it...
Looks good, thanks @h-sug1no! |
This PR add puppeteer(pptr) backend:
msys file systemsomthing is slow, so it is difficult to run tools/visual_regression.sh...Options
VF_GENERATE_OPTIONS:
--backends=<backends>
: Which backend should be enabled by default?--parallel=<jobs>
:Examples
VF_GENERATE_OPTIONS is applied to commands that invoke
generate:hoge
(e.g.VF_GENERATE_OPTIONS='--backends=jsdom' npm run test:reference
).VF_GENERATE_OPTIONS='--backends=jsdom' npm run generate:hoge
VF_GENERATE_OPTIONS='--backends=pptr' npm run generate:hoge
VF_GENERATE_OPTIONS='--parallel=2' npm run generate:hoge
VF_GENERATE_OPTIONS='--backends=jsdom --fonts=petaluma' npm run generate:hoge
VF_GENERATE_OPTIONS='--backends=pptr --module=Beam --parallel=1' npm run generate:hoge
npm run get:releases 3.0.9
node tools/generate_images.js releases/3.0.9 build/images/reference
Speed measurement
Core(TM) i7-4790S CPU @ 3.20GHz
ubuntu(18.04.6 LTS (Bionic Beaver)) VMware on window10
memory: 13G
Limitations
Please review it if it seems to work for this project!