Giter Club home page Giter Club logo

data-bitcode's Introduction

Data.Bitstream

This is an alternative implementation to the [Bool] heavy solution in Data.BitCode.

Data.Bitstream is a LLVM bitcode serializer. The module takes bitcode records and turns them into the bitcode bitstream, which is then written to disk as bytes.

Bitcode

LLVM Bitcode is a series of bits emitted into a stream. This does not need to align with bytes. Notably bytes on disk usually store their least significant bit last, while it would come first in bitcode. Example:

| byte | de | c0 | 17 | 0b | | bits on disk | 11011110 | 1100000 | 00010111 | 00001011 | | bits in stream | 01111011 | 0000011 | 11101000 | 00001011 |

However flipping the bytes in the ByteString prior to writing to disk seems rather cheap (~16M/s) (see bench.html).

Building

With Data.BitCode and Data.BitCode.LLVM, checked out in the same directory as Data.Bistream, this module should be buildable with cabal new-build (see also the cabal.project file).

Testing

cabal new-test should run a series of tests, trying to produce bitcode and ensure some basic validity of the Bitstream.

Benchmarking

cabal new-bench should try to do some rather expensive, yet common bit concatinations on Bitstream and the underlying Stream data types. The benchmark has two parts. One is a synthetic which tries some simple concatination. And the other one is a real world benchmark which attempts to build the object file for main = putStrLn 'Hello World' by taking the serialized bitcode records for said program and runs them through the serializer.

Profiling

The module also contains the test executable. Which takes a serialized bitcode record file as input and runs the Bitstream serializer over it. cabal new-build --enable-profiling should produce the profiled binary.

$(find dist-newstyle -name "test" -type f) bench/data/Main.bcbin +RTS -P

should produce the test.prof profile.

I like viewprof a lot for viewing haskell profiles

data-bitcode's People

Contributors

angerman avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

data-bitcode's Issues

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.