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

Runtime performance hit regardless of checkTypes #12

Open
Gipphe opened this issue Jan 21, 2019 · 0 comments
Open

Runtime performance hit regardless of checkTypes #12

Gipphe opened this issue Jan 21, 2019 · 0 comments

Comments

@Gipphe
Copy link
Contributor

Gipphe commented Jan 21, 2019

The signature passed to the created def function is resolved regardless whether checkTypes is true or not, meaning there is currently a potential, unnecessary performance drain from resolving those signatures which are then subsequently discarded immediately in production environments.

import $ from 'sanctuary-def';
import {create} from 'hm-def';

const def = create ({
  checkTypes: false,
  env: $.env,
  typeClasses: [],
});

const foo = def
  // This signature will be parsed and resolved to an `Array Type`, regardless of `checkTypes` above.
  ('foo :: Boolean -> Boolean')
  (x => !x);

The resolved signature is never used by sanctuary-def's def when checkTypes is false anyways.

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

No branches or pull requests

1 participant