Components.js icon indicating copy to clipboard operation
Components.js copied to clipboard

Allow context validation in componentsjs-compile-config to be skipped

Open RubenVerborgh opened this issue 4 years ago • 5 comments

Issue type:

  • :bug: Bug

Description:

When working on CSS, we noticed that our validation script went from seconds to minutes between 3.x and 4.x:

componentsjs-compile-config urn:solid-server:default:Initializer -c config/default.json -f > /dev/null

Environment:

4.x

Crash log:

RubenVerborgh avatar Jul 20 '21 14:07 RubenVerborgh

Thanks for reporting!

github-actions[bot] avatar Jul 20 '21 14:07 github-actions[bot]

Yes, I'm aware of this (and this is intentional).

That's because of the type-scoped context functionality that is very expensive to handle according to the spec (background: https://github.com/rubensworks/jsonld-context-parser.js/issues/34). The expensive part of the algorithm is usually not needed, so it's disabled in most cases for Components.js. However, I've decided to enable the expensive check when compiling a config, since this is usually not done so often.

(it used to run for much longer than minutes, so it has already been optimized a lot 😅 )

If needed, we can add a CLI param to componentsjs-compile-config to disable this check?

rubensworks avatar Jul 20 '21 14:07 rubensworks

If needed, we can add a CLI param to componentsjs-compile-config to disable this check?

I'd love that. Thanks!

RubenVerborgh avatar Jul 20 '21 14:07 RubenVerborgh

Another idea: in CSS, I would probably first do the fast check, and then the slow one, just as a smoke test. Maybe that is interesting behavior too.

RubenVerborgh avatar Jul 20 '21 14:07 RubenVerborgh

For future reference, the internals are already in place to do this. It's just a matter of adding the arg here:

  • https://github.com/LinkedSoftwareDependencies/Components.js/blob/master/bin/compile-config.ts
  • https://github.com/LinkedSoftwareDependencies/Components.js/blob/master/lib/util/CompileUtil.ts#L21

rubensworks avatar Jul 20 '21 14:07 rubensworks