Calvin Rose
05166b3673
Fix proc getter bug.
2020-12-31 16:23:20 -06:00
Calvin Rose
0a1c93b869
Add ev api for making threaded calls.
...
Easy way to make arbitrary functions in C async.
2020-12-31 16:12:42 -06:00
Calvin Rose
788f91a36f
Remove unneeded book keeping for sub processes.
...
Since we are not using signals we no longer need some bookkeeping.
2020-12-31 11:52:12 -06:00
Calvin Rose
c831ecf5d2
Working implementation of process waiting with threads.
...
Does not require all sorts of signal handling code
that is not thread-safe and can "steal processes".
However, there is a much simpler way to add this functionality
by creating a new stream and thread for each subprocess when it is
waited on. This is perhaps _slightly_ less efficient but oh so much
simpler, since we can reuse all of our concepts from streams and there
is no need to implement a whole system around the selfpipe.
2020-12-31 11:22:18 -06:00
Calvin Rose
9e42ee153c
Merge branch 'master' into HEAD
2020-12-30 12:19:13 -06:00
Calvin Rose
d457aa5951
Deprecate file/popen.
...
os/spawn is the prefered way of creating a subprocess and
communicating with it.
2020-12-30 10:22:45 -06:00
Calvin Rose
ab37ee6ebb
Add :all option to ev/read.
...
Brings ev/read more in line with file/read.
2020-12-29 20:37:59 -06:00
Calvin Rose
8655530b19
Rename predicates in module/paths
2020-12-29 19:52:26 -06:00
Calvin Rose
27b1f59aa9
Change Ctrl-C and move old behavior to Ctrl-Q
...
This lets Janet be a better unix citizen and lets Ctrl-C
raise an interrupt. Trying to make Janet behave superficially
like a shell by overriding Ctrl-C is not helpful.
2020-12-29 16:20:37 -06:00
Calvin Rose
cc2cc4db43
Merge pull request #541 from sogaiu/match-doc-formatting
...
Tweak match docstring
2020-12-29 13:10:35 -06:00
Calvin Rose
20bcd95279
Merge commit '0ea77cabfb30afc15433581f5888171c1f65aafd'
2020-12-28 12:20:21 -06:00
Calvin Rose
d7954be5e5
Update docstring for os/open.
2020-12-28 11:00:15 -06:00
Felix Riedel
0ea77cabfb
Tweak sort: use insertion sort for small arrays
2020-12-28 16:06:48 +00:00
Felix Riedel
0d46352ff4
Revert to better performing number hash.
2020-12-27 14:05:40 +00:00
sogaiu
ffa0d5fe45
Tweak match docstring
2020-12-27 13:42:22 +09:00
Calvin Rose
a2c837a99c
Merge remote-tracking branch 'felixr/master' into master
2020-12-26 20:06:34 -06:00
Calvin Rose
13d8d11011
Try new number hashing with frexp.
...
This may be a bit slower in some cases but generally should
have much better hashing for numbers.
2020-12-26 16:54:14 -06:00
Calvin Rose
2357b6162f
Update test-install target.
2020-12-26 15:42:13 -06:00
Calvin Rose
b4f242193d
Improve hash function for numbers.
2020-12-26 15:38:04 -06:00
Calvin Rose
7242ee0186
Merge pull request #540 from felixr/better-quicksort
...
Improve quicksort to avoid worst case performance on sorted input
2020-12-26 15:23:01 -06:00
Felix Riedel
3e742ffc4c
Improve quicksort to avoid worst case performance.
...
The current implementation will have quadratic behaviour for already
sorted arrays because it picks the last element as pivot. In an sorted
array this splits the array repeatedly into the biggest value and all
other values.
The implementation in this commit uses the *median of three* as pivot.
`janet -e "(sort (range 10000))"` to reproduce quadratic behaviour.
2020-12-26 19:18:17 +00:00
Felix Riedel
2ec12fe06f
Improve hashing of numbers
...
Using an integer hash (https://stackoverflow.com/a/12996028/60617 ) on
the number casted to int32 combined with lower bits of the number.
2020-12-26 13:09:11 +00:00
Felix Riedel
c76e0ae685
Use boost's way of combining hash values for arrays and kv pairs.
...
`seed ^= hash_value(v) + 0x9e3779b9 + (seed << 6) + (seed >> 2);`
from https://www.boost.org/doc/libs/1_35_0/doc/html/boost/hash_combine_id241013.html
The current way of combining hashes peforms poorly on hash values of
numbers. Changing the way hashes are combined canlead to a significant speed up:
```
time janet_new -e '(def tbl @{}) (loop [x :in (range 1000) y :in (range 1000)] (put tbl {0 x 1 y} true))'
3.77s user 0.08s system 99% cpu 3.843 total
time janet_orig -e '(def tbl @{}) (loop [x :in (range 1000) y :in (range 1000)] (put tbl {0 x 1 y} true))'
48.98s user 0.15s system 99% cpu 49.136 total
```
2020-12-26 13:05:03 +00:00
Calvin Rose
25ded775ad
Add array/clear.
...
Also improve map, find-index, and find to work on data structures
which do not defined length.
2020-12-18 12:37:58 -06:00
Calvin Rose
cae4f19629
Merge pull request #532 from pyrmont/feature.parser-line-col-setting
...
Update (parser/where) to support optional line and column
2020-12-15 19:03:25 -06:00
Michael Camilleri
04f6c7b156
Clarify docstring of parser/where
2020-12-15 16:41:45 +09:00
Michael Camilleri
77b79e9899
Update (parser/where) to support optional line and column
2020-12-15 14:12:33 +09:00
Calvin Rose
a55354357c
Make dofile error if source file errors.
...
This should make dofile a bit easier to use.
It also means that import properly raises errors when
things go bad.
2020-12-14 08:23:06 -06:00
Calvin Rose
392d5d51df
Fix build info for 1.13.1
2020-12-13 11:59:52 -06:00
Calvin Rose
9bc996a630
Prepare for 1.13.0 initial release.
2020-12-13 11:17:10 -06:00
Calvin Rose
7b709d4c68
Prevent buffer/trim from shrinking buffer to 0 bytes as well.
2020-12-13 09:38:35 -06:00
Calvin Rose
eab5f67c5c
Fix buffer with NULL data pointer issue.
...
Simply prevent buffers from ever having a NULL data pointer.
2020-12-13 09:33:57 -06:00
Calvin Rose
6020106000
Address #529
2020-12-11 19:21:54 -06:00
Calvin Rose
12f470ed10
Use :_name instead of :name for printing tagged tables.
2020-12-11 18:28:09 -06:00
Calvin Rose
945cbcfad6
Tail recursive match implementation.
...
This implementation uses multiple passes on patterns
to remove the need for a sentinel value to check if there was a match.
This also re-uses extracted subpatterns for complicated patterns.
2020-12-10 08:35:34 -06:00
Calvin Rose
d53007739e
Invert read/write bits on pipe in os/execute.
...
It was backwards, breaking this functionality.
2020-12-09 19:04:05 -06:00
Calvin Rose
6eaf8272e1
Merge pull request #525 from uvtc/patch-1
...
light markup in some docs in corelib
2020-12-07 15:57:09 -06:00
Calvin Rose
6fb83dce06
Merge pull request #526 from sogaiu/tweak-comment
...
Tweak comment for janet_fiber_popframe
2020-12-07 15:56:25 -06:00
John Gabriele
52addc877d
Use xs
2020-12-07 14:07:13 -05:00
sogaiu
53a5f3d2dc
Tweak comment for janet_fiber_popframe
2020-12-07 12:23:27 +09:00
Calvin Rose
711ee5a36d
Merge branch 'preload'
2020-12-06 21:06:59 -06:00
Calvin Rose
cd09b696b5
Add :preload loader.
2020-12-06 21:06:17 -06:00
John Gabriele
df1ca255a9
parts/xs --> pieces
2020-12-06 21:29:30 -05:00
Calvin Rose
811a5d93f4
Prevent some potential bad characters in test out.
2020-12-06 17:10:18 -06:00
John Gabriele
adbe361b9b
light markup in some docs in corelib
2020-12-06 17:51:48 -05:00
Calvin Rose
0f16f21677
Make builds deterministic again.
...
Also prevent marshal from creating multiple copies of
a function - (marshal function pointer before function def pointer).
2020-12-06 16:32:23 -06:00
Calvin Rose
aa0de01e5f
Fix some formatting and undefined behavior.
2020-12-06 14:33:08 -06:00
Calvin Rose
785757f2f6
Remove pthreads from shell.c and update bsd build.
2020-12-06 13:51:06 -06:00
Calvin Rose
01120dfc46
Try and fix openbsd st.ht build.
...
Oneline meson configs, remove extra `cd janet`.
2020-12-06 11:57:40 -06:00
Calvin Rose
a119eb4ef0
Merge branch 'master' of github.com:janet-lang/janet
2020-12-06 11:47:46 -06:00