Skip to content

Commit

Permalink
dramatically improve performance of UnaryType and BinaryType
Browse files Browse the repository at this point in the history
The predicate and extractor functions provided to the UnaryType and
BinaryType type constructors play an important role in type checking.
Each predicate function may be applied hundreds of times when a small
program is run. This is not a problem, in and of itself.

If these oft-applied functions are themselves type-checked, though,
run-time type checking is significantly more expensive as a result.

This commit disables type checking of predicate and extractor functions.
  • Loading branch information
davidchambers committed Mar 29, 2019
1 parent 0b0955c commit 74eae87
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -1472,8 +1472,8 @@
({})
([String_,
String_,
Function_ ([Any, Boolean_]),
Function_ ([Unchecked ('t a'), Array_ (Unchecked ('a'))]),
Unchecked ('(Any -> Boolean)'),
Unchecked ('(t a -> Array a)'),
AnyFunction])
(function(name) {
return B (B (B (def (stripNamespace (name)) ({}) ([Type, Type]))))
Expand Down Expand Up @@ -1616,9 +1616,9 @@
({})
([String_,
String_,
Function_ ([Any, Boolean_]),
Function_ ([Unchecked ('t a b'), Array_ (Unchecked ('a'))]),
Function_ ([Unchecked ('t a b'), Array_ (Unchecked ('b'))]),
Unchecked ('(Any -> Boolean)'),
Unchecked ('(t a b -> Array a)'),
Unchecked ('(t a b -> Array b)'),
AnyFunction])
(function(name) {
return B (B (B (B (def (stripNamespace (name))
Expand Down

0 comments on commit 74eae87

Please sign in to comment.