Skip to content

main.aug ​

Record allocation benchmark · Source and specification

Files in this project

Code ​

aug
// aug-spec: "main.aug.md" explains this file. Read it before changes; refresh with aug spec.
import Item from data
int iterations = 50000
own List<Item> values = []
int index = 0
while index < iterations:
    values.append(value=Item(id=index, name="August"))
    index = index + 1
int checksum = 0
for item in values:
    checksum = checksum + item.id
print(value=checksum)
aug
// aug-spec: "main.aug.md" explains this file. Read it before changes; refresh with aug spec.
import Item from data
int iterations = 50000
own List<Item> values = []
int index = 0
while index < iterations {
    values.append(value=Item(id=index, name="August"))
    index = index + 1
}
int checksum = 0
for item in values {
    checksum = checksum + item.id
}
print(value=checksum)

Compiled specification ​

Interactions and sequences

Startup ​

It sets iterations to 50000. It stores a list with no items in owned values (List<Item>). It sets index to 0. While index is less than iterations, it appends an Item with id from index and name "August" to values; then it increases index by 1. source

After the loop, it sets checksum to 0. For each item in a snapshot of values, it increases checksum by item.id. After the loop, it prints checksum. source

Dependencies ​

It uses Item (id) from data.

Built-in operations follow the language reference.

Last updated:

The world runs on language