mirror of
https://github.com/fluencelabs/aqua-playground
synced 2025-03-15 01:51:03 +00:00
Add a simple aquavm bencmbark
This commit is contained in:
parent
321d311c07
commit
ec641f5672
@ -1,4 +1,5 @@
|
||||
import "println.aqua"
|
||||
import "stream.aqua"
|
||||
import "@fluencelabs/aqua-lib/builtin.aqua"
|
||||
|
||||
-- showcases `for` instruction that compiles to `fold` in AIR
|
||||
@ -7,7 +8,18 @@ func iterateAndPrint(strings: []string):
|
||||
print(s)
|
||||
|
||||
func iterateAndPrintParallel(nodes: []string, c: Info -> ()):
|
||||
stream: *string
|
||||
|
||||
for s <- nodes par:
|
||||
for s2 <- nodes par:
|
||||
for s3 <- nodes par:
|
||||
for s4 <- nodes par:
|
||||
for s5 <- nodes par:
|
||||
for s6 <- nodes par:
|
||||
-- for s7 <- nodes par:
|
||||
stream <- Stringer.returnString(s)
|
||||
|
||||
for s <- stream par:
|
||||
on s:
|
||||
ads <- Peer.identify()
|
||||
c(ads)
|
||||
|
@ -43,6 +43,7 @@ var peer2: FluencePeer;
|
||||
const relays = config.relays
|
||||
|
||||
// setLogLevel('debug');
|
||||
jest.setTimeout(1000*100);
|
||||
|
||||
describe('Testing examples', () => {
|
||||
beforeAll(async () => {
|
||||
|
@ -1,15 +1,22 @@
|
||||
import { Fluence } from '@fluencelabs/fluence';
|
||||
import { iterateAndPrint, iterateAndPrintParallel } from '../compiled/examples/fold';
|
||||
import { registerStringer} from '../compiled/examples/stream';
|
||||
|
||||
|
||||
export async function foldCall() {
|
||||
const relayPeerId = Fluence.getPeer().getStatus().relayPeerId;
|
||||
registerStringer({
|
||||
returnString: (args0) => {
|
||||
return args0;
|
||||
},
|
||||
});
|
||||
|
||||
await iterateAndPrint([relayPeerId], {ttl: 10000});
|
||||
await iterateAndPrint([relayPeerId], {ttl: 1000000});
|
||||
|
||||
return new Promise<string[]>((resolve, reject) => {
|
||||
iterateAndPrintParallel([relayPeerId], (c) => {
|
||||
iterateAndPrintParallel([relayPeerId, relayPeerId], (c) => {
|
||||
console.log('iterateAndPrintParallel. external addresses: ' + c.external_addresses);
|
||||
resolve(c.external_addresses);
|
||||
}, {ttl: 10000});
|
||||
}, {ttl: 1000000});
|
||||
});
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user