navi-language / navi

Navi is a high-performance programming language.
https://navi-lang.org
96 stars 1 forks source link

Navi

Navi (/ˈnævi/) is a high-performance programming and stream computing language developed in Rust, originally designed for complex and high-performance computing tasks. It is also suited as a glue language embedded within heterogeneous services in financial systems.

In addition to its capabilities as a statically-typed, compiled language, Navi offers the convenience of script-like execution. It can compile source code into Bytecode (without JIT) or Machine Code (with JIT), providing a flexible development workflow. Theoretically, Navi delivering competitive performance on par with Go, Rust, and C.

Language Design Philosophy

Installation

curl -sSL https://navi-lang.org/install | sh

This script is also used for upgrading.

Or install a specific version:

# Install the latest nightly version
curl -sSL https://navi-lang.org/install | sh -s -- nightly
# Install a specific version
curl -sSL https://navi-lang.org/install | sh -s -- v0.9.0-nightly

Usage

Run navi -h to get help.

$ navi -h
Usage: navi [OPTIONS] [COMMAND]

Commands:
  run      Run a navi script
  test     Test a navi script
  compile  Compile a navi script and show the bytecode
  help     Print this message or the help of the given subcommand(s)

Options:
  -p, --path <PATH>  Module path
  -h, --help         Print help information
  -V, --version      Print version information

Run a Navi program

You can create a file named with .nv extension, and write some code in it, for example:

// main.nv
use std.io;

fn main() throws {
  io.println("Hello World.");
}

test "Hello World" {
  assert 1 == 1;
}

Then run it by:

$ navi run
Hello world, this is Navi.

$ navi test

Examples

In examples directory, we provide some examples, you can run it by:

$ navi run

Development Tools

Provides a Language Server Protocol(LSP) for Navi and Navi Stream, supporting most IDEs like VS Code, VIM, etc.

VS Code Extension

You can visit VS Code Marketplace and install it.

https://marketplace.visualstudio.com/items?itemName=huacnlee.navi

Performance

With the MACD indicator (about 2000 times indicator calculation), Navi takes 300 µs to calculate MACD once, and due to the characteristics of stream computing, in the server-side scenario where a large number of real-time calculations are required, Navi can rely on the calculation data of history to improve the efficiency of calculation, and Navi will get hundreds of times performance improvement.

Currently, we test that the memory occupied by 1.2 million targets in the server-side is only 1G.

Which scenarios can Navi be used?

Where is the source code?

There still have a lot of works need to do (Performance, Programming Features, Documents, Development Tools ...).

We may open source this project in future when we completed all of that.