Commit Graph

42440 Commits

Author SHA1 Message Date
Matthew Flatt
540c58bbe8 use POPCNT instruction when available on x86_64
On x86_64, a POPCNT instruction is usually available, and it can speed
up `fxpopcount` operations by a factor of 2-3.

Since POPCNT isn't always available, code using `fxpopcount` is
compiled to a call to a generic implementation. The linker substitutes
a POPCNT instruction when it determines at runtime that POPCNT is
available.

Some measurements on a 2018 MacBook Pro (2.7 GHz Core i7) using the
program below:

 popcnt = this implementation, POPCNT discovered
 nocnt  = this implementation, POPCNT considered unavailable
 optcnt = compile to use POPCNT directly (no linker work)
 cpcnt  = compile to inlined generic (no linker work, no POPCNT)

Since the generic implementation is always a 64-bit popcount, it's not
as good as an inlined version for `fxpopcount32`, but otherwise the
link-edit approach to POPCNT works well:

            fxpopcount      fxpopcount32
 popcnt:       0.098s
 nocnt:        0.284s
 optcnt        0.109s  [slower means noise?]
 cpcnt:        0.279s         0.188s

 (optimize-level 3)
 (time
  (let loop ([v #f] [i 100000000])
    (if (fx= i 0)
        v
        (loop (fxpopcount i) (fx- i 1)))))

original commit: 5f090e509f8fe5edc777ed9f0463b20c2e571336
2020-01-11 11:04:48 -07:00
Matthew Flatt
b8398f796c improve hash microbenchmarks 2020-01-11 09:52:36 -07:00
Matthew Flatt
e71963c48b openssl: condition versionless based on current, not cross target 2020-01-10 14:16:30 -07:00
Matthew Flatt
76726ee928 cs: improve stencil-vector HMAT hash-keys-subset? performance
Also, improve some hash benchmarks.
2020-01-10 10:46:55 -07:00
Matthew Flatt
d5930a18c6 configure: fix --disable-mac64 mode as cross-compile mode 2020-01-09 07:24:27 -07:00
Gustavo Massaccesi
f88714210b fix signature in primdata
original commit: bcb7841a33645c55bdd839c3de80bce53ce78402
2020-01-09 10:24:03 -03:00
Matthew Flatt
8c5d580d5a cs: fix cross-compile build steps 2020-01-08 06:41:23 -07:00
Matthew Flatt
57e19c9d8f repair a test for weak-hash iteration 2020-01-08 06:13:22 -07:00
John Clements
4bdad475e1 Post-release version for the v7.6 release 2020-01-07 13:02:31 -08:00
Matthew Flatt
a60f173b46 hash benchmarks and stencil-vector HAMT experiment
This commit adds an (unused) implementation of immutable hash tables
for Racket CS that trades some run-time performance for an especially
compact representation --- similar to the traditional Racket
implementation of immutable hash tables. It uses a new "stencil
vector" datatype at the Chez Scheme level, which overlays the bitmap
needed for a HAMT node with the Chez-object type tag (and also
provides an update operation that avoids unnecessary memory work).

Compared to the current Racket CS implementation, the stencil-vector
HAMT implementation of an immutable hash table takes only about 1/3
the space on avergae, which translates to a overall 5% savings in
DrRacket's initial heap. It also makes a full Racket build slightly
faster by reducing avergage memory use by 5-10%.

But the run-time performance difference is significant, especially for
the `hash-keys-subset?` operation (at least in microbenchmarks), and
also for addition and iteration. Maybe there's an overall better point
that reduces memory use of the current Patricia trie implementation
without sacrificing as much performance.

Besides the benchmarks and stencil-vector HAMT implementaiton, there
are small changes to the way hash tables cooperate with `equal?`,
which makes it a little easier to plug in different implementations.
2020-01-06 07:07:48 -07:00
Matthew Flatt
81ea967aea add stencil vectors and fxpopcount
original commit: ec766fca869b5e0407c4f54230b72619af73b40b
2020-01-06 05:34:28 -07:00
Matthew Flatt
27883d2749 another repair to bitwise-arithmetic-shift/ash folding
Fuzz testing exposed a problem with the example

   (bitwise-arithmetic-shift-left -1 -1)

original commit: fc6f411ffc65f436d54979dfc0455ae771f3375d
2020-01-06 05:34:28 -07:00
Matthew Flatt
f0a63b5921 rktio: repair for building without ptherad support 2020-01-06 04:09:26 -07:00
Tommy McHugh
fc258725ba added struct/derived, tests, and doc updates 2020-01-04 09:24:10 -05:00
Sam Tobin-Hochstadt
e039b19653 Repair bitwise-arithmetic-shift/ash on bad first arguments.
Fixes 0b0777912b1aa80.

original commit: d1a82e712c9c4645c1d790162827ad4e5d8c9f1d
2020-01-03 11:42:05 -05:00
Dominik Pantůček
58cfb6654a Update fixnums documentation to suggest require'ing only fixnum-related parts of racket/unsafe/ops and not the rest of unsafe ops. 2020-01-02 15:10:52 -05:00
Alexis King
07f060133c racket-build-guide: Don’t decode within exec/commandline 2020-01-02 12:17:07 -06:00
Gustavo Massaccesi
7e647535b4 don't fold ash in cp0 when the shift is too big
fix also bitwise-arithmetic-shift/-right/-left.

  primdata.ss, cp0.ss, 5_3.ms

original commit: 0b0777912b1aa80cff108dc1d34917bb80875e0b
2020-01-02 13:03:19 -03:00
Gustavo Massaccesi
8796743cbd cp0: reduce (if <boolean> #t #f)
It may help to reduce expressions like
  (and <boolean> <obviously-true>)

original commit: bf6d3134a306f0cf12768f344d647ceaf820e9fa
2020-01-02 13:03:19 -03:00
Matthew Flatt
8ae53d9e8b fix _bytes/nul-terminated for NULL results
Closes #2995
2020-01-02 08:46:34 -07:00
Matthew Flatt
2efa342323 speed up objlist
Instead of using `%` to compute the index into an oblist, use a power
of 2 for the oblist length and bit masking to compute an index. (Maybe
the old hashing function was bad; the current hashing function should
produce good hash-code variation at the level of bits.) Also, make the
oblist array a little sparser to reduce bucket chaining.

original commit: fb87fcb8e47902b80654789d059a25bd4a7a8def
2020-01-01 15:08:52 -07:00
Matthew Flatt
e97639e525 cs: faster string-copy!
Similar to e087059f21.
2020-01-01 15:00:23 -07:00
Matthew Flatt
e88c2b18e6 fix license blurb in "racket/src/README.txt" 2020-01-01 12:22:34 -07:00
Matthew Flatt
16cbb5be30 makefile: add pre-processing step for distribution creation 2020-01-01 07:13:53 -07:00
Matthew Flatt
647f172acd compiler-test: improve progress output for raco exe tests 2019-12-31 17:17:01 -07:00
Matthew Flatt
6816bdcf2b raise timeout for hash-memory test 2019-12-31 16:35:35 -07:00
Matthew Flatt
ba83d95339 cs configure: avoid --enable-shared problems
Building with shared libraries is not currently supported, because the
Chez Scheme build is not set up to work in that mode, and because
"stand alone" executable handling at the Racket level does not support
Racket CS shared libraries.

Also, there's no benefit to shared libraries. Racket executables get
the benefit of sharing because they all run through the same
executable. Meanwhile, there's not (yet?) a supported C API to make
something like "libracketcs.so" useful.

Related to #2993
2019-12-31 08:03:01 -07:00
Matthew Flatt
bbbda808e5 propagate $AR and $ARFLAGS to submodule builds
original commit: 652aed04f243ce4a7f5c71f18d1754952380a479
2019-12-31 07:58:12 -07:00
Tommy McHugh
0d1a85237e Implemented struct/contract and testing for struct/contract 2019-12-30 19:01:26 -06:00
Matthew Flatt
af3c22dd11 cs: mark some internal representations as sealed
This change makes a small but measurable difference for mpairs, at
least (about 5% on the mpair-intensive "lists.rkt" benchmark).
2019-12-30 08:15:23 -07:00
Matthew Flatt
69444da5a0 clear temporary bignum registers
After a bignum computation using temporary thread registers W, U, or V
is complete, clear ther register. (The X and Y registers hold only
small bignums, so clearing them doesn't matter in the same way.)

original commit: a9e11fcf9e86aee5d149764476e1fabfeee12f84
2019-12-30 07:03:19 -07:00
Matthew Flatt
ce4ad668b6 cs & thread: move retry callback to cancel result
Adjust part of the internal scheduling protocol to make a retry
callback generated by another callback that sets up the retry. This
helps clarify the protocol and avoids allocating a closure that is
rarely used.
2019-12-29 18:56:42 -07:00
Matthew Flatt
755e914c7c cs & thread: allow evt-chaperone to hide other membership
Make Racket CS consistent with traditional Racket in the way
`chaperone-evt` on a thread hides threadness, etc.

Hiding properties like threadness is not ideal and does not seem
entirely consistent with `chaperone-of`, but allowing things like
threads and semaphores to be chaperoned creates non-trivial expense
internally. It would have been better to have event constructors for
threads and such to (and then the consyructed events could be
chaperoned without imposing a cost on the original data structure).
2019-12-29 19:19:09 -06:00
Matthew Flatt
b8a4e0535f thread: small simplification in scheduler 2019-12-29 11:35:06 -06:00
Matthew Flatt
38b789d056 remove accidentally committed ".so" file 2019-12-29 07:50:43 -06:00
Matthew Flatt
c8f44d6597 cs & thread: remove redundant internal atomically 2019-12-29 07:08:15 -06:00
Matthew Flatt
e087059f21 add unsafe-bytes-copy!
Also, improve checking and performance of safe `bytes-copy!` in Racket
CS.
2019-12-28 10:55:57 -06:00
Matthew Flatt
085dd494d7 cs: speed up hash-map and hash-for-each on mutable hash tables
Specialize internal iteration to avoid the overhead of going though
the `hash-iterate-...` interface for each step.
2019-12-28 09:17:41 -06:00
Matthew Flatt
8b3fd15803 cs: simplify mutable hash table iteration
Remove some complexity that originally handled `eq?` unreliability on
flonums, which is no longer needed.
2019-12-28 09:00:20 -06:00
Matthew Flatt
2fcdd7c292 cs: improve equal?-based immutable hash
Check leaf hash code before a more general (and potentially much
slower) equality check.
2019-12-28 08:05:22 -06:00
Matthew Flatt
330ae24ce1 cs: tweak immutable hash-ref implementation
Force inlining of value and key accessors. Keeping the `define` with a
loop body --- that is, not making the individual function a macro ---
allows the Rumble `define` to avoid a closure allocation for the loop.
2019-12-28 06:23:25 -06:00
Matthew Flatt
8ef11a9b06 makefile: use --recurse-submodules for initial ChezScheme checkout
Related to #2945
2019-12-27 05:12:05 -06:00
Matthew Flatt
7675d58fb2 avoid --exclude with git-describe
The `--exclude` flag is not supported by older-but-still-used version
of Git.

original commit: a5a594f7c3f71d17d2e55ed50463b92515de02dc
2019-12-27 04:58:56 -06:00
Matthew Flatt
c6e9d6cfd4 cs: unbreak racket with no command-line arguments 2019-12-26 07:04:35 -06:00
Matthew Flatt
e6e28fa8b7 cs: further corrections to racket command-line argument handling 2019-12-26 07:02:32 -06:00
Shu-Hung You
ccbd93e49c Stop -v from changing init-lib config 2019-12-26 07:02:24 -06:00
Matthew Flatt
15d7c439df fix name on port sent through place channel 2019-12-26 05:04:08 -06:00
Matthew Flatt
90abbb912d cs: guard internal hash traversals against GCed keys
Hash iteration can fail if a GC collects a key in between
`hash-iterate-next` and `hash-iterate-key` (and similar). Use the
optional extra argument internally to detect and handle that case.
2019-12-26 05:04:08 -06:00
Matthew Flatt
6352009def sometimes-faster fixnum / via quotient
Try `fxquotient` with a `fx*` check to implement `/` on fixnums.
That's fast enough to be much faster when it works, and only slows
down a more general `/` a little.

original commit: e91430be9b71f4913965db688a15f6d7206b38f3
2019-12-25 08:04:09 -06:00
shhyou
9db9991df6 Fix racket help string typo 2019-12-24 21:14:35 -06:00