The Racket repository
Go to file
Gustavo Massaccesi bfa269982f optimizer: don't move APPN_FLAG_OMITTABLE inside lambdas
Some expressions are omittable only when the arguments have certain types.
In this case the application is marked with APPN_FLAG_OMITTABLE instead of relaying on the flags of the primitive.

The optimizer can't use this flag to move the expression inside a lamba or across a potential continuation capture, unlike other omittable expressions. They can be moved
only in more restricted conditions.

For example, in this program

  #lang racket/base

  (define n 10000)
  (define m 10000)
  (time
   (define xs (build-list n (lambda (x) 0)))
   (length xs)
   (define ws (list->vector xs)) ; <-- omittable
   (for ([i (in-range m)])
     (vector-ref ws 0)))     ; <-- ws is used once

If the optimizer moves the expression in the definition of ws inside the recursive
lambda that is created by the for, then the code is equivalent to:

  #lang racket/base

  (define n 10000)
  (define m 10000)
  (time
   (define xs (build-list n (lambda (x) 0)))
   (length xs)
   (for ([i (in-range m)])
     (vector-ref (list->vector xs) 0)))     ; <-- moved here

And the new code is O(n*m) instead of O(n+m). This example is a minimized version
of the function kde from the plot package, where n=m and the bug changed the run
time from linear to quadratic.
2016-07-31 08:58:54 -03:00
pkgs optimizer: don't move APPN_FLAG_OMITTABLE inside lambdas 2016-07-31 08:58:54 -03:00
racket optimizer: don't move APPN_FLAG_OMITTABLE inside lambdas 2016-07-31 08:58:54 -03:00
.gitattributes Don't include git files in archives. 2010-05-12 01:46:05 -04:00
.gitignore Add *.orig, *.rej and *.core files to gitignore. 2015-11-06 10:25:13 -06:00
.mailmap mailmap updates & fixes. 2013-04-03 18:10:22 -04:00
.travis.yml Fix CI tests for match test move. 2015-12-30 10:39:45 -05:00
appveyor.yml Fix CI tests for match test move. 2015-12-30 10:39:45 -05:00
INSTALL.txt Corrected a few typos in INSTALL.txt 2016-06-02 13:39:39 -05:00
Makefile Moved xrepl to be part of bootloader directly. 2016-07-26 10:14:38 -04:00
README.md Add info to README. 2016-07-13 10:38:54 -04:00

Linux/Mac Build
Status Windows build status

This is the source code for the core of Racket. See "INSTALL.txt" for full information on building Racket.

To build the full Racket distribution from this repository, run make in the top-level directory. To build the Minimal Racket, run make base.

The rest of the Racket distribution source code is in other repositories under the Racket GitHub organization.

Contribute to Racket by submitting a pull request, joining the development mailing list, or visiting the IRC channel.

License

Racket Copyright (c) 2010-2016 PLT Design Inc.

Racket is distributed under the GNU Lesser General Public License (LGPL). This implies that you may link Racket into proprietary applications, provided you follow the rules stated in the LGPL. You can also modify Racket; if you distribute a modified version, you must distribute it under the terms of the LGPL, which in particular states that you must release the source code for the modified software.

See racket/src/COPYING_LESSER.txt for more information.