GithubHelp home page GithubHelp logo

zakuro-ai / zakuro-cache Goto Github PK

View Code? Open in Web Editor NEW
3.0 1.0 1.0 47 KB

Zakuro module used to keep python scripts execution logs and results in a cached memory.

Dockerfile 3.42% Python 91.79% Shell 4.79%
zakuro python caching caching-library cache

zakuro-cache's Introduction

zakuro Logo


ZakuroCache is a Python package that provides two high-level features:

  • A simple decorator to identify the pure functions you want to cache.
  • A caching system that never repeat twice the same execution and return a cached result instead.

You can reuse your favorite Python packages such as NumPy, SciPy and Cython to extend ZakuroCache integration.

ZakuroCache modules

At a granular level, ZakuroCache is a library that consists of the following components:

Component Description
zakuro_cache Contains the implementation of the caching sytem.
zakuro_cache.loggers Keep the print into an array during the fuction execution.
zakuro_cache.function Pipeline to execute and store.

Installation

Docker

To build the image with docker-compose

sh docker.sh

Local

python setup.py install

Performances

If you are in local env you can run:

python demo.py

You should be able to execute a benchmark:

=====ZAKURO-CACHE=====
0.03user 0.00system 0:00.03elapsed 97%CPU (0avgtext+0avgdata 15444maxresident)k
0inputs+128outputs (0major+2493minor)pagefaults 0swaps


=====NO-CACHE=====
10.18user 0.00system 0:10.18elapsed 99%CPU (0avgtext+0avgdata 15568maxresident)k
496inputs+128outputs (3major+2491minor)pagefaults 0swaps

Getting-started

To apply the cache simply add the decorator to your functions.

from zakuro_cache.function import pure

@pure
def recur_fibo(n):
    if n <= 1:
        return n
    else:
        res1, res2 = recur_fibo(n - 1), recur_fibo(n - 2)
        return res1 + res2


if __name__ == "__main__":
    nterms = 35
    for i in range(nterms):
       print(recur_fibo(i))

zakuro-cache's People

Stargazers

 avatar  avatar  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.