112 lines
3.9 KiB
Markdown
112 lines
3.9 KiB
Markdown
# Second Racket implementation of Syndicate
|
||
|
||
## Quickstart
|
||
|
||
raco pkg install syndicate
|
||
|
||
or
|
||
|
||
git clone https://git.syndicate-lang.org/syndicate-lang/syndicate-rkt
|
||
cd syndicate-rkt
|
||
make link
|
||
|
||
For more detail, [see below](#compiling-and-running-the-code).
|
||
|
||
## The language itself
|
||
|
||
This repository contains a [Racket](http://racket-lang.org/)
|
||
implementation of Syndicate, which includes
|
||
|
||
- the implementation of the `#lang syndicate` language, in the
|
||
[`syndicate` directory](syndicate/).
|
||
|
||
- a TCP echo server example, which listens for connections on port
|
||
5999 by default, in
|
||
[`syndicate-examples/echo.rkt`](syndicate-examples/echo.rkt).
|
||
Connect to it using, for example, `telnet localhost 5999`.
|
||
|
||
- a number of other examples both small and large, in
|
||
[`syndicate-examples/`](syndicate-examples/).
|
||
|
||
## New implementation
|
||
|
||
This is a reimplementation of Syndicate that takes the language-level
|
||
constructs of facets, endpoints, and fields to heart, integrating
|
||
knowledge of facets and endpoints into the dataspace implementation
|
||
itself.
|
||
|
||
It gains a *significant* performance advantage by doing so.
|
||
|
||
Programs seem to be about *20x faster* (compared to the
|
||
[previous implementation](https://git.syndicate-lang.org/syndicate-lang/syndicate-2017/src/branch/main/racket)).
|
||
Some are only 10x faster, some are 30x faster.
|
||
|
||
The implementation techniques herein are the subject of a forthcoming
|
||
paper. The prototype that embodies the new idea is in
|
||
[historical/prototype.rkt](historical/prototype.rkt), and
|
||
[syndicate/HOWITWORKS.md](syndicate/HOWITWORKS.md) describes the
|
||
approach via prose.
|
||
|
||
All the drivers end up looking much nicer with this new
|
||
implementation. The previously-separate GL-2D support is now
|
||
integrated as just another driver (though the timing characteristics
|
||
of the old implementation are not precisely preserved). The
|
||
[ground.rkt](syndicate/ground.rkt) implementation is much cleaner.
|
||
|
||
To see the difference in speed, try out the "many Racket logos"
|
||
animation example/demo after installing the `syndicate` and
|
||
`syndicate-examples` packages:
|
||
|
||
racket -l syndicate-examples/gl-2d-many
|
||
|
||
Hopefully you'll get a smooth 60fps, though I admit I'm running it on
|
||
a fairly fast machine so you might need to drop the `sprite-count` in
|
||
the code a bit to sustain 60fps.
|
||
|
||
## Compiling and running the code
|
||
|
||
You will need Racket version 7.6 or later. (If you're using Racket CS,
|
||
you'll need version 7.8 or later because of
|
||
[this issue](https://github.com/racket/racket/issues/3132).)
|
||
|
||
Once you have Racket installed, run
|
||
|
||
raco pkg install syndicate
|
||
|
||
to install the package from the Racket package repository, or
|
||
|
||
raco pkg install --link syndicate
|
||
|
||
from the root directory of the Git checkout to install the package
|
||
from a local snapshot. This will make `#lang syndicate` available to
|
||
programs.
|
||
|
||
Repeat the process with `syndicate-examples` in place of `syndicate`
|
||
to install the examples as well.
|
||
|
||
Alternatively, `make link` from the root directory of the Git checkout
|
||
installs both packages from the local copy.
|
||
|
||
### Running the tests
|
||
|
||
The implementation test suite lives in [syndicate/test/](syndicate/test/). Run it with:
|
||
|
||
raco setup syndicate; raco test -p syndicate
|
||
|
||
## Copyright and License
|
||
|
||
Copyright © Tony Garnock-Jones 2010–2021.
|
||
|
||
This program is free software: you can redistribute it and/or modify
|
||
it under the terms of the GNU Lesser General Public License as published by
|
||
the Free Software Foundation, either version 3 of the License, or
|
||
(at your option) any later version.
|
||
|
||
This program is distributed in the hope that it will be useful,
|
||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||
GNU Lesser General Public License for more details.
|
||
|
||
You should have received a copy of the GNU Lesser General Public License
|
||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|