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

improve performance of NullaryType #258

Merged
merged 1 commit into from
Apr 5, 2019
Merged

Conversation

davidchambers
Copy link
Member

This pull request brings $.NullaryType into line with $.UnaryType and $.BinaryType, which as of #244 do not type-check predicate functions.

On my computer, the following program takes about 40 seconds to run on this branch compared with about 140 seconds on master:

'use strict';

const $ = require ('.');

const a = $.TypeVariable ('a');

const zeros = []; for (let x = 0; x < 1e6; x += 1) zeros.push (0);

$.create
  ({checkTypes: true,
    env: [$.Array ($.Unknown),
          $.NullaryType ('Zero') ('') ([]) (x => x === 0)]})
  ('I')
  ({})
  ([a, a])
  (x => x)
  (zeros);

@davidchambers davidchambers requested a review from Avaq April 5, 2019 11:30
@davidchambers davidchambers merged commit 72bf9df into master Apr 5, 2019
@davidchambers davidchambers deleted the davidchambers/perf branch April 5, 2019 16:22
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.

2 participants