Code Monkey home page Code Monkey logo

levin's Introduction

Levin - A Quick Way to Bulk Loading

Description

Levin provide a highly efficient solution in bulk loading scene. A collection of STL-like containers implemented with high performance and memory efficiency. Levin containers arrange memory layout SEQUENTIALLY, allocated at share memory region for reused inter-process. which prolongs the lifetime of data resources, and prevents unnecessary time-consuming reload.

Loading with levin speed, let's get started.

Getting Started

  • Brief Intro for Levin Container
STD Container Levin Container Notes Suggestion
vector<T> SharedVector<T> T is POD type
set<K, Compare> SharedSet<K, Compare> K is POD type use SharedHashSet if no comparison
map<K, V, Compare> SharedMap<K, V, Compare> K/V is POD type use SharedHashMap if no comparison
unordered_set<K, Hash, Pred> SharedHashSet<K, Hash, Pred> K is POD type
unordered_map<K, V, Hash, Pred> SharedHashMap<K, V, Hash> K/V is POD type
vector<vector<T> > SharedNestedVector<T, SizeType> T is POD type; SizeType is unsigned integral type specified SizeType for memory space efficiency
unordered_map<K, vector<V> > SharedNestedHashMap<K, V> K/V is POD type
vector<map<K, V, Compare> > SharedNestedMap<K, V, Compare, SizeType> K/V is POD type; SizeType is unsigned integral type
  • How to Dump Container
// vector dump demo
std::vector<int> vec_data = {1, 2, 3, 4, 5};
levin::SharedVector<int>::Dump("./vec_demo.dat", vec_data);
// map/hashmap dump demo
std::unordered_map<int64_t, int32_t> map_data = { {1, 100}, {2, 200}, {3, 300} };
// or std::map<int64_t, int32_t> map_data = { {1, 100}, {2, 200}, {3, 300} };
levin::SharedHashMap<int64_t, int32_t>::Dump("./map_demo.dat", map_data);
  • How to Use Container

Tips: Levin container SHOULD be used as static data, NOT suggest to modify or reallocate.

// shared vector use demo
levin::SharedVector<int> vec("./vec_demo.dat");
if (vec.Init() == levin::SC_RET_OK && vec.Load() == levin::SC_RET_OK) {
    ...
}
vec.Destroy();
// shared hashmap use demo
auto map_ptr = new levin::SharedHashMap<int64_t, int32_t>("./map_demo.dat");
if (map_ptr->Init() == levin::SC_RET_OK && map_ptr->Load() == levin::SC_RET_OK) {
    ...
}
map_ptr->Destroy();
delete map_ptr;
  • How to Manage a set of Containers

example code of container manager usage

Dependencies

Levin depends on following packages, supported deps:

  • gcc >= 4.8.5
  • cmake >= 2.6.0
  • boost >= 1.56.0
  • openssl
  • gtest

Compile

  • create directory build, cd build
  • compile: cmake .. && make

Documentation

About the details, please see Wiki.

Contributing

Welcome to contribute by creating issues or sending pull requests. See Contributing Guide for guidelines.

Communication

QQ

License

Levin is licensed under the Apache License 2.0. See the LICENSE file.

levin's People

Contributors

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