[racket-dev] Use unsafe in reverse.rkt ?

2014-05-01 Thread Gustavo Massaccesi
I was reading the alternative implementation of reverse in
http://git.racket-lang.org/plt/blob/HEAD:/racket/collects/racket/private/reverse.rkt
and I thought that the “car” and “cdr” could be replaced by the
“unsafe” versions.

I tried a few changes:

* Use unsafe-car and unsafe-cdr

* Remove the eval-jit-enabled check, because parameters are slow.
(Perhaps it can be checked at compile-time instead of at run-time.)

* Use begin-encourage-inline because map.rkt uses it. (But I think
that begin-encourage-inline is not very useful in reverse.rkt.)

I compared the versions (program at the bottom) The program measure
1 times, the time to do 100 reverses of a 1 list.

fast-reverse  168.32 (modified version)
priv-reverse  169.13 (copy of reverse.rkt)
reverse  168.95 (original version)
values  109.77 (use values instead of reverse)

Average time of n=1 runs, sigma~=15, sigma/sqrt(n)~=0.15

In this test, the new version is 0.4% faster, but if we subtract the
time of the “values” version the improvement is 1%.

If you find this useful, I can look at map.rkt.

Gustavo

;-- fast-reverse.rkt
(module reverse '#%kernel
  (#%require '#%unsafe racket/private/performance-hint)
  (#%provide alt-reverse)

  (begin-encourage-inline

(define-values (alt-reverse)
  (let-values ([(reverse)
(lambda (l)
  (if (list? l)
(void)
(raise-argument-error 'reverse list? l))
  (letrec-values ([(loop)
   (lambda (a l)
 (if (null? l)
   a
   (loop (cons (unsafe-car l)
a) (unsafe-cdr l])
(loop null l)))])
reverse


;--- time-reverse.rkt
#lang racket/base
(require (rename-in private-reverse.rkt (alt-reverse priv-reverse)))
(require (rename-in fast-reverse.rkt (alt-reverse fast-reverse)))

(define-syntax-rule (test-time proc msg)
  (begin
(display (string-append run: msg : ))
(time (begin
(display (for/sum ([k (in-range 100)])
   (length (proc (for/list ([i (in-range 1)]) i)
(display  )))
(display (string-append gc3: msg : 0 ))
(time
 (collect-garbage)
 (collect-garbage)
 (collect-garbage)
 )
))

(collect-garbage)
(collect-garbage)
(collect-garbage)

(for ([z (in-range 1)])
  (test-time values  values   )
  (test-time reverse reverse  )
  (test-time priv-reversepriv-reverse )
  (test-time fast-reversefast-reverse )

_
  Racket Developers list:
  http://lists.racket-lang.org/dev


[racket-dev] Release Announcement for v6.0.1

2014-05-01 Thread Ryan Culpepper

The release announcement sketch that I have so far is below.  Please
mail me new items and/or edits.
--

mflatt:
- 2x bitmaps (037a211f, e47a90cc, etc); file/convertible (eda4f357)
- retina displays (7dc63162)
- dc alignment scale (582e9925)
- bignum performance (780d6ae5)
- added syntax/wrap-modbeg (bfda0665)
- treat FFI primitives like other primitives (eff53cde)
- add PLTUSERHOME (e4ce0d03)
- fix bignum allocation (efa19918)
- add racket/undefined (8abf7825, 74f82bbd)

robby:
- check syntax info even with syntax errors (09920bd8)
- contract system change, more first-order-friendly (c321f6dd)
- class/c changes (2989918a, 7bec967c, 4f65d57f, 59f57b1b)

vincent:
- contract profiler (cc0e6763, 7495243d, etc)
- make f[lx]vectors sequences (8e32e6e4)

asumu:
- TR :-less syntax (e6e3ab4e, 45d36579, 37b09521, etc)
- explain/warn about Class types?
- TR recursive type aliases (a8cc430d)

samth:
- web pages? (154b5453, etc)

neil:
- plot 3D BSP tree (a515e7ce)
- PDF/PS scaling changed to 1.0x1.0 (efc46ded)

--
_
 Racket Developers list:
 http://lists.racket-lang.org/dev


Re: [racket-dev] Release Announcement for v6.0.1

2014-05-01 Thread Robby Findler
The ones near my name:

 - Check Syntax cooperates with Typed Racket to show arrows and other
Check Syntax highlighting even when there is a type error

 - Functions provided via contract-out that have first-order contracts
perform better

Robby

On Thu, May 1, 2014 at 12:49 PM, Ryan Culpepper ry...@ccs.neu.edu wrote:
 The release announcement sketch that I have so far is below.  Please
 mail me new items and/or edits.
 --

 mflatt:
 - 2x bitmaps (037a211f, e47a90cc, etc); file/convertible (eda4f357)
 - retina displays (7dc63162)
 - dc alignment scale (582e9925)
 - bignum performance (780d6ae5)
 - added syntax/wrap-modbeg (bfda0665)
 - treat FFI primitives like other primitives (eff53cde)
 - add PLTUSERHOME (e4ce0d03)
 - fix bignum allocation (efa19918)
 - add racket/undefined (8abf7825, 74f82bbd)

 robby:
 - check syntax info even with syntax errors (09920bd8)
 - contract system change, more first-order-friendly (c321f6dd)
 - class/c changes (2989918a, 7bec967c, 4f65d57f, 59f57b1b)

 vincent:
 - contract profiler (cc0e6763, 7495243d, etc)
 - make f[lx]vectors sequences (8e32e6e4)

 asumu:
 - TR :-less syntax (e6e3ab4e, 45d36579, 37b09521, etc)
 - explain/warn about Class types?
 - TR recursive type aliases (a8cc430d)

 samth:
 - web pages? (154b5453, etc)

 neil:
 - plot 3D BSP tree (a515e7ce)
 - PDF/PS scaling changed to 1.0x1.0 (efc46ded)

 --
 _
  Racket Developers list:
  http://lists.racket-lang.org/dev
_
  Racket Developers list:
  http://lists.racket-lang.org/dev


Re: [racket-dev] Release Announcement for v6.0.1

2014-05-01 Thread Asumu Takikawa
On 2014-05-01 13:49:55 -0400, Ryan Culpepper wrote:
 asumu:

  * Types in Typed Racket are now pretty-printed.

  * Function types can now be written in prefix style, which is
now preferred and is used for printing. Infix function types
are still accepted for backwards compatibility.

  * A new `-*' type constructor is used for writing types for
functions with optional and keyword arguments. The notation
is similar to the matching contract combinator.

 - TR :-less syntax (e6e3ab4e, 45d36579, 37b09521, etc)

  * Typed Racket forms do not have a `:' suffix by default now.
For example, the `struct' form replaces `struct:'. The suffixed
versions are all provided for backwards compatibility.

 - explain/warn about Class types?

  * Typed Racket now has preliminary support for classes and
objects. However, it is still experimental and the APIs are subject
to change.

 - TR recursive type aliases (a8cc430d)

  * Type aliases in Typed Racket now support recursion and mutual
recursion. For example, `(define-type (MyList X) (U Null (Pair X (MyList 
X'
is now a valid type alias.

Cheers,
Asumu
_
  Racket Developers list:
  http://lists.racket-lang.org/dev


Re: [racket-dev] Release Announcement for v6.0.1

2014-05-01 Thread Vincent St-Amour
At Thu, 01 May 2014 13:49:55 -0400,
Ryan Culpepper wrote:
 vincent:
 - contract profiler (cc0e6763, 7495243d, etc)

Nothing significant for this release.

 - make f[lx]vectors sequences (8e32e6e4)

Not sure that's worth putting in the release notes, but if we decide it
is, here's a bullet:

- flvectors and fxvectors are sequences, and can be iterated over with
  the `for' family of forms.


Vincent
_
  Racket Developers list:
  http://lists.racket-lang.org/dev


Re: [racket-dev] Release Announcement for v6.0.1

2014-05-01 Thread Neil Toronto

On 05/01/2014 11:49 AM, Ryan Culpepper wrote:

The release announcement sketch that I have so far is below.  Please
mail me new items and/or edits.
--

neil:
- plot 3D BSP tree (a515e7ce)
- PDF/PS scaling changed to 1.0x1.0 (efc46ded)


 - Plot correctly renders intersecting 3D graphs and non-grid-aligned 
3D rectangles.


 - Elements in plots output in PDF/PS format have the same relative 
scale as in other formats. In particular, it is not necessary to adjust 
`plot-font-size` to make PDF plots look the same as PNG.


Neil

_
 Racket Developers list:
 http://lists.racket-lang.org/dev


Re: [racket-dev] Release Announcement for v6.0.1

2014-05-01 Thread Eric Dobson
6f56948cff75dd4497b742ae01cd5df18c654e6f
- The contract boundary between typed/untyped modules is much less expensive.


dd8b646b0b3a0fd7905467f275f0f786eac958dd
- Occurrence typing now works better with when/unless.
Example:
(let ((x (read)))
  (unless (number? x) (error 'bad-input))
  (add1 x))


On Thu, May 1, 2014 at 2:16 PM, Neil Toronto neil.toro...@gmail.com wrote:
 On 05/01/2014 11:49 AM, Ryan Culpepper wrote:

 The release announcement sketch that I have so far is below.  Please
 mail me new items and/or edits.
 --

 neil:
 - plot 3D BSP tree (a515e7ce)
 - PDF/PS scaling changed to 1.0x1.0 (efc46ded)


  - Plot correctly renders intersecting 3D graphs and non-grid-aligned 3D
 rectangles.

  - Elements in plots output in PDF/PS format have the same relative scale as
 in other formats. In particular, it is not necessary to adjust
 `plot-font-size` to make PDF plots look the same as PNG.

 Neil


 _
  Racket Developers list:
  http://lists.racket-lang.org/dev
_
  Racket Developers list:
  http://lists.racket-lang.org/dev


Re: [racket-dev] Release Announcement for v6.0.1

2014-05-01 Thread Robby Findler
On Thu, May 1, 2014 at 8:44 PM, Eric Dobson eric.n.dob...@gmail.com wrote:
 6f56948cff75dd4497b742ae01cd5df18c654e6f
 - The contract boundary between typed/untyped modules is much less expensive.

This one plus the one on the contract system side should probably be
combined into a single bullet item:

- the boundary between Typed Racket and Racket program is now much
less expensive because of improvements in TR's contract generation and
improvements in the contract system's support for first-order
contracts

Robby


 dd8b646b0b3a0fd7905467f275f0f786eac958dd
 - Occurrence typing now works better with when/unless.
 Example:
 (let ((x (read)))
   (unless (number? x) (error 'bad-input))
   (add1 x))


 On Thu, May 1, 2014 at 2:16 PM, Neil Toronto neil.toro...@gmail.com wrote:
 On 05/01/2014 11:49 AM, Ryan Culpepper wrote:

 The release announcement sketch that I have so far is below.  Please
 mail me new items and/or edits.
 --

 neil:
 - plot 3D BSP tree (a515e7ce)
 - PDF/PS scaling changed to 1.0x1.0 (efc46ded)


  - Plot correctly renders intersecting 3D graphs and non-grid-aligned 3D
 rectangles.

  - Elements in plots output in PDF/PS format have the same relative scale as
 in other formats. In particular, it is not necessary to adjust
 `plot-font-size` to make PDF plots look the same as PNG.

 Neil


 _
  Racket Developers list:
  http://lists.racket-lang.org/dev
 _
   Racket Developers list:
   http://lists.racket-lang.org/dev
_
  Racket Developers list:
  http://lists.racket-lang.org/dev


Re: [racket-dev] Release Announcement for v6.0.1

2014-05-01 Thread Sam Tobin-Hochstadt
On May 1, 2014 10:01 PM, Robby Findler ro...@eecs.northwestern.edu
wrote:

 On Thu, May 1, 2014 at 8:44 PM, Eric Dobson eric.n.dob...@gmail.com
wrote:
  6f56948cff75dd4497b742ae01cd5df18c654e6f
  - The contract boundary between typed/untyped modules is much less
expensive.

 This one plus the one on the contract system side should probably be
 combined into a single bullet item:

 - the boundary between Typed Racket and Racket program is now much
 less expensive because of improvements in TR's contract generation and
 improvements in the contract system's support for first-order
 contracts

I don't see why we shouldn't have two bullets. Your change improves things
for everyone who uses contracts, not just typed programs.

I think Eric's changes should be a little more specific -- Typed Racket now
avoids generating contracts for places where contracts failures cannot
happen, maybe.

Sam


 Robby

 
  dd8b646b0b3a0fd7905467f275f0f786eac958dd
  - Occurrence typing now works better with when/unless.
  Example:
  (let ((x (read)))
(unless (number? x) (error 'bad-input))
(add1 x))
 
 
  On Thu, May 1, 2014 at 2:16 PM, Neil Toronto neil.toro...@gmail.com
wrote:
  On 05/01/2014 11:49 AM, Ryan Culpepper wrote:
 
  The release announcement sketch that I have so far is below.  Please
  mail me new items and/or edits.
  --
 
  neil:
  - plot 3D BSP tree (a515e7ce)
  - PDF/PS scaling changed to 1.0x1.0 (efc46ded)
 
 
   - Plot correctly renders intersecting 3D graphs and non-grid-aligned
3D
  rectangles.
 
   - Elements in plots output in PDF/PS format have the same relative
scale as
  in other formats. In particular, it is not necessary to adjust
  `plot-font-size` to make PDF plots look the same as PNG.
 
  Neil
 
 
  _
   Racket Developers list:
   http://lists.racket-lang.org/dev
  _
Racket Developers list:
http://lists.racket-lang.org/dev
 _
   Racket Developers list:
   http://lists.racket-lang.org/dev
_
  Racket Developers list:
  http://lists.racket-lang.org/dev


Re: [racket-dev] Release Announcement for v6.0.1

2014-05-01 Thread Matthew Flatt
At Thu, 01 May 2014 13:49:55 -0400, Ryan Culpepper wrote:
 mflatt:
 - 2x bitmaps (037a211f, e47a90cc, etc); file/convertible (eda4f357)
 - retina displays (7dc63162)
 - dc alignment scale (582e9925)
 - bignum performance (780d6ae5)
 - added syntax/wrap-modbeg (bfda0665)
 - treat FFI primitives like other primitives (eff53cde)
 - add PLTUSERHOME (e4ce0d03)
 - fix bignum allocation (efa19918)
 - add racket/undefined (8abf7825, 74f82bbd)


 * A new `racket/undefined` library exports `undefined` as the
   value currently produced by

   (letrec ([x x]) x)

   This library anticipates a future where that expression will raise
   an exception. The `racket/undefined` library will continue to offer
   the `undefined` value as a bridge between versions and as a last
   resort.

 * The drawing and GUI libraries provide improved support for
   high-resolution bitmaps and their use on Retina displays. For
   example, `read-bitmap` includes a `#:try-@2x?` option to trigger
   substitutions through the usual @2x naming convention.

_
  Racket Developers list:
  http://lists.racket-lang.org/dev