Skip to content
AntonYudintsev edited this page Jan 10, 2019 · 23 revisions

daScript is high-performance strong statically typed scripting language, with

  • no garbage collection,
  • "pure" stateless (it's state survives only one script run)
  • "native" machine types (no nan-tagging or anything)
  • explicit structs
  • cheap "inter-op"

In a real world scenario, it's 10+ times faster than lua-jit without JIT (and even faster than liajit with JIT). It also allows Ahead-of-Time compilation, which is not only possible on all platforms (unlike JIT), but also always faster/not-slower (JIT is known to sometimes slow down scripts).

Table with performance comparisons

It's philsophy is build around modified Zen of Python.

  • Performance counts.
  • But not at the cost of safety.
  • Readability counts.
  • Explicit is better than implicit.
  • Simple is better than complex.
  • Complex is better than complicated.
  • Flat is better than nested.

Typical Fibonacci sample:

 def fibR(n)
     if (n < 2)
         return n
     else
         return fibR(n - 1) + fibR(n - 2)

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

More complicated particles kinematics:

struct NObject
     position, velocity : float3

def updateParticles(objects:array<NObject>)
    for obj in objects
        obj.position += obj.velocity

def initParticles(objects:array<NObject>)
    resize(objects, 50000)
    for obj, index in objects, range(0,length(objects))
        let oi = float(index)
        obj.position=float3(oi+0.1,oi+0.2,oi+0.3)
        obj.velocity=float3(1.0,2.0,3.0)

def test()
    let objects:array<NObject>
    initParticles(objects)
    print("created {length(objects)} particles")
    updateParticles(objects,100)

It's (not)full list of features includes:

  • strong typing
  • Ruby-like blocks
  • tables
  • arrays
  • string-builder
  • native (c++ friendly) interop
  • generics
  • semantic indenting
  • ECS-friendly interop
  • etc, etc

options keyword

Clone this wiki locally