Coder Social home page Coder Social logo

test-encoder's Introduction

test-encoder

uhh simple array encoder/decoder
it encodes fasts but decodes slow

Usage

Installation

git clone https://github.com/Cowrod/test-encoder.git
cd test-encoder

Example usage

-- require the module and fs
local encoder = require('./main')
local fs = require('fs')

-- example 1.
fs.writeFileSync("myEncodedData.log", encoder.encode{
    index1 = "index2",
    [9] = (function()
        local output = {}
        for i = 1, 500 do
            table.insert(output, math.random(-1e13, 1e13))
        end
        return output
    end)(),
    what = "yes"
})

local decodedData = encoder.decode(fs.readFileSync("myEncodedData.log"))[1]

-- example 2.
for i = 1, 1e3 do
    local data = {
        id = i,
        data1 = math.random(-1e13, 1e13),
        data2 = randomstr(math.random(100))
    }
    fs.appendFileSync("myUpdatedData.log", encoder.encode(data))
    data = nil
end

local updatedData = encoder.decode(fs.readFileSync("myUpdatedData.log"))

Benchmark

lua benchmark.lua
luajit benchmark.lua
luvit benchmark.lua
#... or whatever lua compiler you are using i guess

License

GNU General Public License v3.0

test-encoder's People

Contributors

cowrod avatar

Stargazers

 avatar

Watchers

 avatar

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.