perl Archives

Repository of examples using Perl and Assembly together

Sometimes one needs an extra ounce of performance. Why not combine the high level semantics of Perl with the punch of assembly?

This repo includes various examples of how this can be done.

Caching & Memoization with state variables

Chapter 3 of Higher Order Perl describes various approaches to memoization of an expensive function: private cache and the Memoize module. The book was written in 2005 (Perl was at version 5.8 back then) , so it does not include another way for function caching that is now available : caching through state variables (introduced in Perl 5.10). The Fibonacci example considered in HOP also requires the ability to initialize state hash variables (available since Perl 5.28). The code below contrasts the implementation with a state…

Parallel Perl/C applications without tears using OpenMP: Controlling the OpenMP environment

Brett Estrade, did it again with yet another excellent talk at TPRC 2024 about the use of OpenMP for parallelizing Perl/C code. This is an area that is extremely interesting as OpenMP is a rather straightforward way to parallelize code using simple compiler pragmas in Inline::C sections of code. Furthermore, as I discussed at TPRC2024, the combination of the Many Core Engine (/users/chrisarg/perl/index.html

Is Perl a write only language?

I am sick and tired of hearing this, so let's put it this to the test. Assume you know little of Perl, or any programming language for that matter. Can you parse the code?

https://chrisarg.github.io/Killing-It-with-PERL/2023/12/06/Is-Perl-a-write-only-language.html

I hope the piece above is the first in a series to convince people to consider the reality before passing judgement. It was inspired by one of our research analysts discovering Perl and awk to simplify their l…

Hash of Arrays Deathmatch : Native Perl vs. DBM::Deep vs. Redis

Sometimes one has to make compromises between speed of execution and memory, other times one may not have to be. While working towards a fairly (at least in my mind) complete solution to map Nanopore Sequencing files, I ran against the need to create and access fairly large hash of arrays (think of 1M - 100Mof keys), with each array itself consisting of a a fixed number of elements.
The hash of arrays is a fairly straightforward and fast data structure to create in Perl, the memory overhead can be substantial as the number of keys and values scale upwards.…

Of Go, C, Perl and fastq file conversion Vol II : the Jedi regex

In the second part of this series about fast parsers for sequencing applications,  I will review the code for the regex based parser. This is shown below (I use v5.38, as you should! because the year is 2023 and you should not have to type use strict; use warnings)

="color:…

About chrisarg

user-pic I like to use Perl for material other than text.