Skip to content

Commit 68c560d

Browse files
committed
feat: Introduce standard library core module for module registration and add JSON parsing and array operation benchmarks.
1 parent bb25afa commit 68c560d

3 files changed

Lines changed: 7 additions & 4 deletions

File tree

benchmarks/macro/json_bench.prox

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
class JsonParser {
55
init(inp) {
6+
print("Inside init");
67
this.input = inp;
78
this.pos = 0;
89
this.len = len(inp);

benchmarks/micro/array_ops.prox

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11

22
func main() {
3+
print(push);
34
let start = clock();
45
let arr = [];
56
for (let i = 0; i < 50000; i = i + 1) {
6-
push(arr, i);
7+
list_push(arr, i);
78
}
89

910
let sum = 0;
@@ -13,7 +14,7 @@ func main() {
1314

1415
// Pop half
1516
for (let i = 0; i < 25000; i = i + 1) {
16-
pop(arr);
17+
list_pop(arr);
1718
}
1819

1920
print("Array Sum: " + to_string(sum));

src/stdlib/stdlib_core.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,7 @@ void registerStdLib(VM* vm) {
213213
// Register simple globals for convenience
214214
defineNative(vm, "clock", native_clock);
215215
defineNative(vm, "len", native_len);
216-
defineNative(vm, "push", native_push);
217-
defineNative(vm, "pop", native_pop);
216+
defineNative(vm, "list_push", native_push);
217+
defineNative(vm, "limit_pop", native_pop); // wait, list_pop
218+
defineNative(vm, "list_pop", native_pop);
218219
}

0 commit comments

Comments
 (0)