Commit Graph

35879 Commits

Author SHA1 Message Date
Matthew Flatt
c9a1dc781e raco setup: use lazy ".zo" parsing for dpeendency checking
Lazy ".zo" parsing make the dependency check take about half as
long.
2016-01-01 13:52:37 -07:00
Matthew Flatt
d3bb9d0412 fix bytecode-reading time-complexity bug
When a tree marshaled to bytecode form has many shared pieces,
the unmarshaling process can lose track of the sharing in one
place and traverse too much of the structure as pieces are
loaded.
2016-01-01 13:52:37 -07:00
Matthew Flatt
8b7f5bc046 faster xexpr->string 2016-01-01 13:52:37 -07:00
Vincent St-Amour
923b5864a5 Small guide fixes.
Closes PR 15109.
2016-01-01 12:52:14 -06:00
Vincent St-Amour
8c8a76979b Fix keyword argument name.
Closes PR 15089.
2016-01-01 12:52:14 -06:00
Vincent St-Amour
4c04d4afce Fix discussion of filter.
Closes PR 15083.
2016-01-01 12:52:14 -06:00
Robby Findler
110f1bd9b0 different, more likely fix 2015-12-31 15:36:33 -06:00
Robby Findler
357b692d33 fix typo 2015-12-31 15:33:59 -06:00
Matthew Flatt
567679bf0a {impersonate,chaperone}-hash: add equal-key-proc wrapper
The optional `equal-key-proc` wrapper effectively interposes on calls
to `equal?` and `equal-hash-code` for hash-table keys.
2015-12-31 09:22:57 -07:00
Robby Findler
e92b8610f2 port id-set/c to late-neg 2015-12-30 19:16:36 -06:00
Robby Findler
85c781452d wording tweaks 2015-12-30 17:57:36 -06:00
Benjamin Greenman
0f7a946dba put contract-property accessors in an itemlist 2015-12-30 17:52:33 -06:00
Benjamin Greenman
61e21dba22 typo: is-flat-contract? -> is-list-contract? 2015-12-30 17:52:26 -06:00
Robby Findler
df382ca939 improve warnings and fix small problems with contract combinator constructors 2015-12-30 17:13:23 -06:00
Robby Findler
cb2af327e6 port async-channel/c to late-neg proj
and drop other projection implementations
(mostly to reduce the testing burden)
2015-12-30 17:13:22 -06:00
Robby Findler
9ee264a0ea improve performance of define-generic-created contracts and port to late-neg
This program runs about 10x faster than it did before this commit, but
seems to still be about 100x slower than the version where you change
an-s to just be (s).

  #lang racket/base
  (require racket/contract/base racket/generic)
  (define-generics id [m id x])
  (struct s () #:methods gen:id [(define (m g x) x)])
  (define an-s
    (contract (id/c [m (-> any/c integer? integer?)])
              (s)
              'pos 'neg))
  (time
   (for ([x (in-range 100000)])
     (m an-s 2)))
2015-12-30 17:13:22 -06:00
Robby Findler
a97aa8389b port id-table/c to flat-neg projection 2015-12-30 17:13:22 -06:00
Sam Tobin-Hochstadt
1c3422d420 Fix CI tests for match test move. 2015-12-30 10:39:45 -05:00
Robby Findler
f2f38cdf4a remove overly aggressive use of procedure-specialize 2015-12-30 09:28:58 -06:00
Robby Findler
a5b3d6b3d0 uncopy some code 2015-12-29 21:46:06 -06:00
Robby Findler
46ace3172f clean up interaction between strict set/c contracts and mutable sets 2015-12-29 20:28:22 -06:00
Robby Findler
757adac568 make #f always convert into the same (eq?) contract 2015-12-29 16:13:01 -06:00
Robby Findler
4bdde405f6 improve the way that 'struct-out' cooperates with the
rest of the contract system, creating and using a slightly
more legitmate blame record and calling into the late-neg
projections instead of using `contract`
2015-12-29 15:48:17 -06:00
Sam Tobin-Hochstadt
893bb56762 Rename to make it clear what to run. 2015-12-29 16:01:22 -05:00
Mira Leung
e2bd1b51bc Using in-list in for/list 2015-12-29 15:59:40 -05:00
Mira Leung
404c5b2699 Better code style for f3d888 2015-12-29 15:59:40 -05:00
Mira Leung
56ea9f8b9a Specify names of missing fields for match on structs 2015-12-29 15:59:40 -05:00
Robby Findler
22adc0253b change sets generics so they default to supplying the optional argument
if the given procedure accepts it
2015-12-29 11:26:17 -06:00
Robby Findler
2c5aa96031 change some potentially error-prone provide all-from-outs to explicit provides
and make set load its implementation via relative requires
2015-12-29 11:25:45 -06:00
Robby Findler
7056cd5f2a improve ->i in the case that the dependent contract
turns out to be a predicate.

In that case, just call it instead of creating all of the extra junk
that would normally be created by coercing the predicate to a contract
and invoking it
2015-12-29 11:20:59 -06:00
Matthew Flatt
a516304f6b fix specialization over a nested lambda 2015-12-29 07:04:17 -06:00
Matthew Flatt
26560240f1 adjust "racket-playsound.exe" return code 2015-12-29 07:04:17 -06:00
Robby Findler
d4ca825640 fix set/c name method 2015-12-29 06:56:20 -06:00
Robby Findler
a44ce40b56 fix a bug in 50405a2ca 2015-12-28 22:17:39 -06:00
Robby Findler
f7465f81f1 convert stream/c to late-neg-projection
Also, tune the projection to get a few modest performance gains.

This program gets about 20% faster:

  #lang racket
  (define s (contract (stream/c exact-nonnegative-integer?)
                      (in-naturals) 'pos 'neg))
  (time
   (for ([x (in-range 1000)])
     (for/fold ([s s])
               ([x (in-range 100)])
       (stream-rest s))))

and this program gets about 15% faster:

  #lang racket
  (define f (contract (-> (stream/c exact-nonnegative-integer?)
                          any)
                      (λ (x) 1)
                      'pos 'neg))
  (define l (make-list 10000 0))
  (time (for ([x (in-range 1000)])
          (f l) (f l) (f l) (f l) (f l)))
2015-12-28 21:57:03 -06:00
Robby Findler
ff31b01505 add some error checking for custom set type constructors 2015-12-28 16:59:43 -06:00
Robby Findler
50405a2ca9 fix chaperone-hash-set and impersonate-hash-set for custom-set-types 2015-12-28 16:59:42 -06:00
Matthew Flatt
e08188aeda add source for "racket-playsound.exe" 2015-12-28 07:37:29 -06:00
Matthew Flatt
cefcbdf802 Windows: ensure 'kill subprocesses end with Racket
Use a job object to ensure that subprocesses that are meant
to be killed by the current custodian are reliably terminated
if Racket exits for any reason.
2015-12-28 07:37:29 -06:00
Matthew Flatt
afa01fa763 allow optimizations around procedure-specialize
Although `procedure-specialize` should be useful in places where
inlining does not apply, allowing inlining and related optimizations
through it, anyway.
2015-12-28 07:37:29 -06:00
Robby Findler
b3d05de304 improvements to set/c
- use chaperone-hash-set for set/c when the contract allows only hash-sets

- add a #:lazy flag to allow explicit choice of when to use laziness
  (but have a backwards-compatible default that, roughly, eschews laziness
   only when the resulting contract would be flat)
2015-12-27 22:56:04 -06:00
Robby Findler
bc12019af4 allow the interposition procedures to all be #f in chaperone-hash-set and impersonate-hash-set 2015-12-27 21:02:20 -06:00
Robby Findler
8f2874e4b5 fix impersonator properties for chaperone-hash-set and impersonate-hash-set 2015-12-26 22:37:00 -06:00
Robby Findler
daf19869de chaperone-hash-set fixes 2015-12-26 22:09:14 -06:00
Robby Findler
1b6705f3d9 typo 2015-12-26 17:01:22 -06:00
Robby Findler
d927d04efd generalize tail contract checking for function contracts
Specifically, remove reliance on procedure-closure-contents-eq? to
tell when a pending check is stronger in favor of usint
contract-stronger?

Also, tighten up the specification of contract-stronger? to require
that any contract is stronger than itself

With this commit, this program gets about 10% slower:

  #lang racket/base
  (require racket/contract/base)
  (define f
    (contract
     (-> any/c integer?)
     (λ (x) (if (zero? x)
                0
                (f (- x 1))))
     'pos 'neg))
  (time (f 2000000))

becuase the checking is doing work more explicitly now but because the
checking in more general, it identifies the redundant checking in this
program

  #lang racket/base
  (require racket/contract/base)
  (define f
    (contract
     (-> any/c integer?)
     (contract
      (-> any/c integer?)
      (λ (x) (if (zero? x)
                 0
                 (f (- x 1))))
      'pos 'neg)
     'pos 'neg))
  (time (f 200000))

which makes it run about 13x faster than it did before

I'm not sure if this is a win overall, since the checking can be more
significant in the case of "near misses". For example, with this
program, where neither the new nor the old checking detects the
redundancy is about 40% slower after this commit than it was before:

  #lang racket/base
  (require racket/contract/base)
  (define f
    (contract
     (-> any/c (<=/c 0))
     (contract
      (-> any/c (>=/c 0))
      (λ (x) (if (zero? x)
                 0
                 (f (- x 1))))
      'pos 'neg)
     'pos 'neg))

  (time (f 50000))

(The redundancy isn't detected here because the contract system only
looks at the first pending contract check.)

Overall, despite the fact that it slows down some programs and speeds
up others, my main thought is that it is worth doing because it
eliminates a (painful) reliance on procedure-closure-contents-eq? that
inhibits other approaches to optimizing these contracts we might try.
2015-12-25 22:58:56 -06:00
Robby Findler
f0f85549ce add impersonate-hash-set and chaperone-hash-set 2015-12-25 22:58:55 -06:00
Robby Findler
c9d192f09b make more explicit that define-custom-set-types produces hash sets. 2015-12-25 22:58:55 -06:00
Robby Findler
badf2bd19e audit requires of files that require misc.rkt in racket/contract 2015-12-25 22:58:55 -06:00
Robby Findler
7708b2056a use specialize-procedure on predicate portion or or/c
This seems to give about a 10% speedup on this program:

 #lang racket/base
(require racket/contract/base)
(define f (contract
           (-> (or/c number? symbol?) any)
           (λ (x) 0)
           'pos 'neg))

(time
 (for ([_ (in-range 1000000)])
   (f 'x) (f 'x) (f 'x) (f 'x)))
2015-12-25 14:17:03 -06:00