Skip to content

Commit

Permalink
#22 edits
Browse files Browse the repository at this point in the history
  • Loading branch information
j50n committed Feb 11, 2022
1 parent 54ba0c1 commit 3055380
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 9 deletions.
14 changes: 10 additions & 4 deletions build
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,23 @@

set -e

deno fmt
deno lint
HERE="$(realpath "$(dirname $0)")"

deno test --allow-run --reload
deno fmt "$HERE"
deno lint "$HERE"

cd ./examples/warandpeace && (
deno test --allow-run --reload "$HERE"

cd "$HERE/examples/warandpeace" && (
set -x
time ./countwords.sh < ./warandpeace.txt.gz
time ./countwords.ts < ./warandpeace.txt.gz
time ./countwords2.ts < ./warandpeace.txt.gz
echo "a b c d" | ./countwords2.ts || true
time ./countwords3.ts < ./warandpeace.txt.gz
echo "a b c d" | ./countwords3.ts || true
)

cd "$HERE/examples/pushiterable" && (
PATH=".:$PATH" ./example-of-pushiterable.ts
)
13 changes: 8 additions & 5 deletions examples/pushiterable/README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
# Use `PushIterable` to Implement Workers

`proc` can be used to manage persistent child processes that accept messages
from your parent process and respond back with messages of their own. This is
simlar to web workers but with fewer limitations.

Note that this isn't limited to processes that run Deno. You could just as
easily run something like `grep` or `awk` or something written in Python.
from your parent process and respond back with messages of their own. In order
to "push" messages to a process, you need to use a
[PushIterable](../../runners/push-iterable.ts). This technique is simlar to web
workers but with fewer limitations.

Note that this isn't limited to processes that run Deno, even though that is our
example. You could just as easily run something like `grep` or `awk` or
something written in Python as a child process that is managed this way.

## Run the Example

Expand Down

0 comments on commit 3055380

Please sign in to comment.