Giter Site home page Giter Site logo

vtenc's People

Contributors

vteromero avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

Forkers

amallia jackyyvan

vtenc's Issues

Always free allocated memory in case of error

When a controlled error occurs in a API function and it needs to stop the execution, we must ensure that any allocated memory is freed before exiting.

Specifically, the *encode* and *decode* functions should always call encctx_close and decctx_close before returning.

At the moment, there are some leak memory when running the unit tests:

valgrind --leak-check=yes ./tests/unit/unit_tests
ERROR SUMMARY: 21 errors from 21 contexts (suppressed: 0 from 0)

Release 0.1.0

  • Tests for random sequences #15
  • Refactor of count_zeros_at_bit_pos* functions to improve encoding performance #16
  • Fix bug on wrongly using memcmp on some testing programs #17 #14
  • Encode lower bits for clusters of length 1 #18

Question about decoding speed

Looks like a great library, I'm exciting to give it a spin!

When I looked at the benchmarks, I was impressed by the high encoding speed. Could you provide an insight why the decoding speed lags an order or magnitude behind the other implementations? Is this purely because the current state of the implementation or is there fundamental algorithmic limitation?

memcmp wrongly used

memcmp compare stream of bytes, not arrays of other bigger types like uint16_t, uint32_t or uint64_t. You can still use it with those types, but you need to properly calculate the number of bytes to compare For example:

const size_t len = 4;
uint32_t a[len] = {0, 1, 2, 3};
uint32_t b[len] = {0, 10, 20, 30};

// WRONG: will output "Arrays are equal"
if (memcmp(a, b, len) == 0) {
  printf("Arrays are equal\n");
} else {
  printf("Arrays are different\n");
}

// CORRECT: will output "Arrays are different"
if (memcmp(a, b, len * sizeof(uint32_t)) == 0) {
  printf("Arrays are equal\n");
} else {
  printf("Arrays are different\n");
}

There are a couple of places where memcmp is being used incorrectly:

  • tests/gov2.c
  • tests/timestamps.c

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.