Giter Site home page Giter Site logo

polly's Introduction

Build Status

Polly

Polly is an OCaml binding for the Linux epoll system call:

  • Small, simple, and self-contained
  • Avoids most allocation in the event loop
  • MIT licensed

Note that epoll is specific to Linux and that this library won't compile on macOS, for example.

Installation

As of version 0.2.2, Polly is now in Opam and can be installed from there:

opam install polly

Most recently version 0.4.1 was submitted to Opam.

Using inside utop

  • make utop or
  • dune utop

launches a utop toplevel that has the library loaded for interactive use.

Other Epoll Bindings

Contribute

If you find this useful, please contribute back by raising pull requests for improvements you made.

polly's People

Contributors

craff avatar edwintorok avatar lindig avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

polly's Issues

release runtime lock around syscalls

Polly should probably release the runtime lock in a few more places, e.g. epoll_create1 and eventfd are both syscalls that may allocate resources and currently they'd block the entire process for their duration.
epoll_ctl is a syscall too, but it may be invoked very frequently (depending how the application) is written, so that one should probably be benchmarked whether releasing the runtime lock is beneficial or not (although in general we should probably release the runtime lock around any syscall - we don't know how long they might take).
The only place where keeping the runtime lock held is beneficial are small library functions that on their fastpaths don't invoke any syscalls.

Polly does release the runtime lock around the very long syscall that waits, so that is fine.

OTOH releasing the runtime lock makes optimizations like #12 impossible, so if we make changes in this area we should probably measure all 3 scenarios (current polly, noalloc polly, and polly with runtime lock released in _ctl), also measuring the impact on other threads that may be blocked.

Optimise stub

The function caml_polly_ctl and the three functions calling it could be called frequently in some applications. We could tag them with noalloc and untagged, raising the exception from OCaml in case of error ?

Adding evenfd inside polly

Could it be possible to add binding for
`ฬ€``
#include <sys/eventfd.h>

int eventfd(unsigned int initval, int flags);

This is only one function, frequently used to wait on mutex/semaphore with epoll. So a binding for just that may be a bit overkill ?

make lint

make lint is not configured in the same way as lint in the worflow ?
on my machine, make lint reports no error while the workflow fails with the same code.

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.