Skip to content

Commit

Permalink
syntax improvements for typescript benchmarks
Browse files Browse the repository at this point in the history
  • Loading branch information
AneesHl committed Feb 19, 2024
1 parent f3a5061 commit 1093943
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 22 deletions.
10 changes: 5 additions & 5 deletions TS/Savina/src/micro/Big.lf
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ target TypeScript {

import BenchmarkRunner from "../BenchmarkRunner.lf";

main reactor Big(numIterations:number(12), limit:number(25000)) {
main reactor Big(numIterations:number=12, limit:number=25000) {

runner = new BenchmarkRunner(numIterations = numIterations);

Expand Down Expand Up @@ -86,7 +86,7 @@ main reactor Big(numIterations:number(12), limit:number(25000)) {

// Index is the number of this ping ponger and must be set
// to x with 1 <= x <= numberOfActors, when the instance is created.
reactor PingPonger(limit:number(25000), index:number(-1), numberOfActors:number(5)) {
reactor PingPonger(limit:number=25000, index:number=-1, numberOfActors:number=5) {
input start:boolean;
output done:null;
output send1:string;
Expand All @@ -110,7 +110,7 @@ reactor PingPonger(limit:number(25000), index:number(-1), numberOfActors:number(
input ack4:string;
input ack5:string;

state remainingServes:number(limit);
state remainingServes:number=limit;

logical action nextServe:null; // As in ping pong serve

Expand Down Expand Up @@ -187,14 +187,14 @@ reactor PingPonger(limit:number(25000), index:number(-1), numberOfActors:number(

}

reactor Sink(numberOfActors:number(5)) {
reactor Sink(numberOfActors:number=5) {
input done1:null;
input done2:null;
input done3:null;
input done4:null;
input done5:null;
output stopTimer:boolean;
state count:number(0);
state count:number=0;

reaction(done1) -> stopTimer {=
count++;
Expand Down
10 changes: 5 additions & 5 deletions TS/Savina/src/micro/Chameneos.lf
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ target TypeScript {

import BenchmarkRunner from "../BenchmarkRunner.lf";

main reactor Chameneos(numIterations:number(12), limit:number(25000)) {
main reactor Chameneos(numIterations:number=12, limit:number=25000) {

// Conversions for updateColor from https://wiki.haskell.org/Shootout/Chameneos
preamble {=
Expand Down Expand Up @@ -101,7 +101,7 @@ main reactor Chameneos(numIterations:number(12), limit:number(25000)) {
l4.ackFriend3 -> l3.responseFriend4;
}

reactor Mall(limit:number(25000)) {
reactor Mall(limit:number=25000) {

preamble {=
function permuteLizards(freeLizards: Array<number>): Array<number> {
Expand Down Expand Up @@ -130,7 +130,7 @@ reactor Mall(limit:number(25000)) {
output l3instruction:number;
output l4instruction:number;

state count:number(0);
state count:number=0;

// Randomly pick a lizard and randomly assign it a friend.
// Then repeat for every other available pair of lizards.
Expand Down Expand Up @@ -183,7 +183,7 @@ reactor Mall(limit:number(25000)) {
=}
}

reactor Lizard (initialColor:Color({=Color.BLUE=})) {
reactor Lizard (initialColor:Color={=Color.BLUE=}) {
input instruction:number;
input fromFriend0:Color;
input fromFriend1:Color;
Expand All @@ -206,7 +206,7 @@ reactor Lizard (initialColor:Color({=Color.BLUE=})) {
output ackFriend2:Color;
output ackFriend3:Color;
output ackFriend4:Color;
state color:Color(initialColor);
state color:Color=initialColor;

timer t(0,1 sec);

Expand Down
6 changes: 3 additions & 3 deletions TS/Savina/src/micro/CountingActor.lf
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ target TypeScript{

import BenchmarkRunner from "../BenchmarkRunner.lf";

reactor Counter(limit:number(25000)) {
reactor Counter(limit:number=25000) {
input receive:number;
output done:boolean;
state count:number(0);
state count:number=0;
reaction (receive) -> done {=
count++;
if (count == limit -1) {
Expand All @@ -25,7 +25,7 @@ reactor Sender {
send = 1;
=}
}
main reactor CountingActor(numIterations:number(12), limit:number(25000)) {
main reactor CountingActor(numIterations:number=12, limit:number=25000) {

runner = new BenchmarkRunner(numIterations = numIterations);

Expand Down
8 changes: 4 additions & 4 deletions TS/Savina/src/micro/Throughput.lf
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ target TypeScript {

import BenchmarkRunner from "../BenchmarkRunner.lf";

reactor ThroughputReactor(totalMessages:number(10000)) {
reactor ThroughputReactor(totalMessages:number=10000) {

preamble {=
function performComputation(theta: number): void {
Expand All @@ -28,13 +28,13 @@ reactor ThroughputReactor(totalMessages:number(10000)) {
}


reactor ThroughputProducer(totalMessages:number(10000), numConsumer:number(60)) {
reactor ThroughputProducer(totalMessages:number=10000, numConsumer:number=60) {

input start:boolean;
output outMessage:boolean;
output finished:boolean;

state sent_messages: number(0);
state sent_messages: number=0;

logical action sendNextMessage;

Expand All @@ -56,7 +56,7 @@ reactor ThroughputProducer(totalMessages:number(10000), numConsumer:number(60))
=}
}

main reactor (numIterations:number(12), numMessagesPerReactor:number(100), numWorkers:number(60)) {
main reactor (numIterations:number=12, numMessagesPerReactor:number=100, numWorkers:number=60) {

runner = new BenchmarkRunner(numIterations=numIterations);
producer = new ThroughputProducer(totalMessages=numMessagesPerReactor, numConsumer=numWorkers);
Expand Down
10 changes: 5 additions & 5 deletions TS/Savina/src/parallelism/Sieve.lf
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

import BenchmarkRunner from "../BenchmarkRunner.lf";

reactor Ramp(totalNumber:number(100000), period:time(1 nsec)) {
reactor Ramp(totalNumber:number=100000, period:time=1 nsec) {
input start: boolean;
output value: number;
output end: boolean;
Expand All @@ -35,13 +35,13 @@ reactor Ramp(totalNumber:number(100000), period:time(1 nsec)) {
=}
}

reactor Filter(primeStart: number(2), primeNumber: number(1000)) {
reactor Filter(primeStart: number=2, primeNumber: number=1000) {

input inp: number;
output out: number;

state localPrimes: {=Array<number>=}({= [] =});
state hasChild: boolean(false);
state localPrimes: {=Array<number>=}={= [] =};
state hasChild: boolean=false;

mutation (inp) -> out {=
let div = false;
Expand Down Expand Up @@ -76,7 +76,7 @@ reactor Filter(primeStart: number(2), primeNumber: number(1000)) {
}


main reactor Sieve(numIterations:number(12), totalNumber:number(100000), primeStart: number(2), primeNumber: number(1000), period: time(1 nsec)) {
main reactor Sieve(numIterations:number=12, totalNumber:number=100000, primeStart: number=2, primeNumber: number=1000, period: time=1 nsec) {
runner = new BenchmarkRunner(numIterations=numIterations);
source = new Ramp(totalNumber=totalNumber, period=period);
filter = new Filter(primeStart=primeStart, primeNumber=primeNumber);
Expand Down

0 comments on commit 1093943

Please sign in to comment.