Skip to content

Are there any JIT mode optimizations flags? #1120

@ArtemkaKun

Description

@ArtemkaKun

Hi, I'm trying to compare daScript performance with the performance of my programming language (Spawn) in the Fibonacci example.
daScript's performance info states the following:

daScript Just-in-Time compilation is based on LLVM backend, and often outperforms C++, due to daScript providing more information to LLVM than AOT. 

and provides the following table

image

daScript code I'm benchmarking is the following:

def fibI(n)
    var last = 1
    var cur = 0
    for i in range(n)
        let tmp = cur
        cur += last
        last = tmp
    return cur

[export]
def main
    print("{fibI(6511134)}")

I'm running it with just das fibI.das

Spawn code is the following:

fn main() {
    print('${fib_i(6511134)}')
}

fn fib_i(n u64) -> u64 {
    mut last := 1
    mut cur := 0

    for i in 0 .. n {
        tmp := cur
	cur += last
	last = tmp
    }

    return cur
}

I'm building executable with ./spawnlang --cc clang --opt-fast --show-timings=false -o fib_sp ../fibI.sp

I'm comparing both daScript and Spawn using hyperfine hyperfine -N --warmup 5 "das fibI.das" ../../spawn/fib_sp
The results are the following

Benchmark 1: das fibI.das
Time (mean ± σ):     292.5 ms ±  11.0 ms    [User: 276.2 ms, System: 13.6 ms]
Range (min … max):   275.4 ms … 319.6 ms    10 runs

Benchmark 2: ../../spawn/fib_sp
Time (mean ± σ):       4.5 ms ±   0.6 ms    [User: 3.1 ms, System: 1.1 ms]
Range (min … max):     2.2 ms …   5.9 ms    574 runs

Summary
../../spawn/fib_sp ran
64.72 ± 8.79 times faster than das fibI.das

Am I doing something wrong? Should I add any optimization flags to daScript build command or something? I can't try AOT for now (see #1119), but seems JIT mode of daScript should perform sometimes better than AOT mode, and I have drastically difference in comparison with my compiled programming language that should have similar performance as AOT

I'm on Arch Linux, with lastest GCC and Clang and dev tools

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions