Git Product home page Git Product logo

fass's Introduction

FASS

FASS is a schema-driven serialization format designed for minimal overhead, high performance, and ease of use. It aims to be as fast as possible while maintaining as little overhead as possible.

Purpose

FASS is a lightweight serialization format meant to efficiently store complex data structures into a comprehensive binary form. Designed for minimal overhead, FASS compiles down to a few memory loads and stores without any need for parsing in order to achieve its blazing fast speed. Because of its ordered structure sequence, it eliminates the need for key storage and computation, bringing a considerable size difference.

Features

  • Schema Driven: FASS uses its own schema format and compiler to generate and optimize complex structures in any supported language.
  • User Defined Types: FASS allows the user to define up to 200 custom data types.
  • Read Without Parsing: FASS eliminates the need for a parser allowing the user to access any section of data without the need to parse first.

Differences compared to other serialization formats

  • The FASS struct type is inspired by Apache Avro's binary format and eliminates the need for keys.
  • Similar to FlatBuffers, FASS implements per-key serialization and deserialization, but experiences less overhead due to its optimizing code generator.
  • It is much more performant than JSON because it takes advantage of the strongly typed schema driven nature to produce much more compact stripped down binary buffers, at the cost of being less dynamic (FASS is not a direct replacement or competitor for JSON).
  • P.S. Need to compare stuff when FASS has a MVP.

Codegen

Take a look at the current codegen in https://github.com/JairusSW/fass/tree/master/examples

AssemblyScript is supported, and TypeScript development is on pause for now.

Types

Primitive Types

  • char
  • u8
  • i8
  • u16
  • i16
  • u32
  • i32
  • u64
  • i64
  • f32
  • f64

Structure Types

  • struct
  • enum

Schema Format

FASS Schemas are designed to be readable and minimal.

A basic example of 3D Vector representation.

Vec3.fass

struct Vec3 {
    x: f32
    y: f32
    z: f32
}

Example of a complex data structure.

Player.fass

include "./Vec3.fass"

struct Player {
    team: Team
    name: char[]
    id: i32
    pos: Vec3
    data: u8[5]
}

enum Team {
    red
    blue
}

Schema Features

Strings

Strings are declared as a array of char

char[]

Arrays

There are two flavors of arrays--fixed and variable length arrays.

A variable length array is a array who's length may vary. These are usually less performant than fixed arrays.

type[]

A fixed array does not change in size and is much more performant.

type[LENGTH_OF_ARRAY]

The same may be applied for strings (char[])

char[LENGTH_OF_STRING]

Many more features will be implemented later :)

Usage (AssemblyScript)

Install from GitHub (While in development)

npm i JairusSW/fass -g

Write your schemas and build the files. We are using a Vector 3 schema for this example.

struct Vec3 {
    x: u8
    y: u8
    z: u8
}```

`fass build INPUT_FOLDER --assemblyscript -o OUTPUT_FOLDER`

Take a look at the generated files, and use the provided classes.

Now, in AssemblyScript, import it

```js
import { Vec3 } from "PATH-TO-VEC3.TS"

fass's People

Contributors

jairussw avatar spotandjake avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

spotandjake

fass's Issues

Cli Mode to add comments

Add a simple cli mode to add comments, this should not be that hard given it would just be some template literals like decode x and such and in langs like grain or assemblyscript for instance these get optimized away so size isnt really a worry.

Document Binary Format

Currently the binary format does not really matter a ton given from a schema you are generating both the encoder and matching pair decoder. This is fine and all but at the end of the day if developers do not know the schema they cannot help with making additions such as porting it to other languages.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.