[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#827539: RFP: libfile-map-perl -- Memory mapping made simple and safe



Package: wnpp
Severity: wishlist

* Package name    : libfile-map-perl
  Version         : 0.64
  Upstream Author : Leon Timmermans <fawaka@gmail.com>
* URL             : https://metacpan.org/release/File-Map
* License         : Artistic or GPL-1+ (same as Perl)
  Programming Lang: Perl
  Description     : Memory mapping made simple and safe

File::Map maps files or anonymous memory into perl variables.

Advantages of memory mapping

 * Unlike normal perl variables, mapped memory is (usually) shared
   between threads or forked processes.
 * It is an efficient way to slurp an entire file. Unlike for example
   File::Slurp, this module returns almost immediately, loading the
   pages lazily on access. This means you only 'pay' for the parts
   of the file you actually use.
 * Perl usually doesn't return memory to the system while running,
   mapped memory can be returned.

Advantages of this module over other similar modules

 * Safety and Speed
  
   This module is safe yet fast. Alternatives are either fast but can
   cause segfaults or loose the mapping when not used correctly, or
   are safe but rather slow. File::Map is as fast as a normal string
   yet safe.

 * Simplicity

   It offers a simple interface targeted at common usage patterns

    * Files are mapped into a variable that can be read just like any
      other variable, and it can be written to using standard Perl
      techniques such as regexps and substr.
    * Files can be mapped using a set of simple functions. There is
      no need to know weird constants or the order of 6 arguments.
    * It will automatically unmap the file when the scalar gets
      destroyed. This works correctly even in multi-threaded programs.

 * Portability

   File::Map supports Unix and Windows.

 * Thread synchronization

   It has built-in support for thread synchronization.


File::Map is required for PDL which has deprecated the POSIX mmap
support. PDL 2.016 still builds without File::Map but this will
change in the near future.


Reply to: