-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test/benchmark: add two tiny benchmark test
ack and 1m coroutine test both fail to run
- Loading branch information
1 parent
499505c
commit 1567487
Showing
4 changed files
with
47 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
(func ack | ||
0 y => (+ 1 y) | ||
x 0 => (ack (- x 1) 1) | ||
x y => (ack (- x 1) (ack x (- y 1)))) | ||
|
||
(let n 13 | ||
(ack 3 n)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
;; create 1M coroutines and check: | ||
;; 1. how much memory it uses | ||
;; 2. how long it takes | ||
|
||
(@import "cora/lib/let-loop") | ||
(@import "cora/lib/cml" cml) | ||
(@import "cora/lib/io" io) | ||
(@import "cora/lib/chan" chan) | ||
|
||
(let ch (chan.make) | ||
N 1000000 | ||
(begin | ||
|
||
(defun create () | ||
(let-loop recur (i 0) | ||
(if (> i N) | ||
(io.display "spawn finish\n") | ||
(begin | ||
(cml.spawn (lambda () | ||
(let v (cml.perform (chan.recv ch)) | ||
(begin | ||
(io.display "receive value") | ||
(io.display v) | ||
(io.display "\n"))))) | ||
(recur (+ i 1)))))) | ||
|
||
(defun boot () | ||
(let-loop recur1 (i 0) | ||
(if (> i N) | ||
(io.display "test finish\n") | ||
(begin | ||
(cml.perform (chan.send ch i)) | ||
(recur1 (+ i 1)))))))) | ||
|
||
(create) | ||
(io.display "here???\n") | ||
(cml.spawn boot) | ||
(cml.main) |