Reini Urban volunteered to show the features of the cperl fork of the Perl language. He began the presentation talking about the problems with Perl 5, which spawned the Perl 6 project.

He stated that cperl is one of implementations of what's being called perl11. This is a movement to rewrite Perl 5 with some of the features developed for Perl 6.

The features that Reini demonstrated included:

  1. Shaped arrays

    Declare an array with a fixed size. Access it normally, but built-ins that change the size of the array (push, shift, etc.) don't work. Allows removal of automatic bounds checking in some instances. Works with types to make more efficient implementations in some cases.

  2. Fast overflow detection

    Perl's numeric scalars automatically switch between integer and floating point representations internally as needed in some cases. This change can be triggered when an integer increases to larger than can be represented by the internal integer representation. This change makes detection of that overflow more efficient.

  3. Signatures

    Support type checks at compile-type or run-time, whichever is possible. Evaluation of parameters is guaranteed to be left to right. Current implementation only understands core types. The return type is declared as an attribute of the sub and supports both core and user-defined types.

  4. Attributes for optimizing function calls
  5. Static loop optimizations for shaped arrays

    Since the size of a shaped array is known at compile-time, some optimizations are available that cannot apply to traditional Perl arrays.

  6. Remove bounds checking inside loops
  7. Convert static methods to subs

    Under some circumstances, a method can be promoted to a method on a subclass early instead of walking the inheritance tree to find it.

  8. Config is built-in and written in XS

    The data in the Config hash is knoow at installation time, so he generates a constant, perfect hash that is just loaded into memory instead of building a traditional hash dynamically.

  9. Unicode optimizations for size
  10. Hash improvements

    Reini has done some extensive research into hash functions and believes he knows them better than almost anyone else. He compared the hashing techniques used by a number of other languages and has identified FNV1A as ideal for his purposes. It's very fast, but not secure against collisions. He argues that the secure property is not useful in hashing functions used for hashes.

    He described different techniques for dealing with hash table collisions. He also discussed the rate at which the hash table fills, and different approaches for growing the vector containing the table.

    As part of his research, he has apparently forked the SMHasher test suite to extend testing as he saw fit. He also maintains the perl-hash-stats project.

As usual, Reini's presentation was heavy on implementation and design details. If you are not the kind of person who enjoys data structures, the hashing section would probably make your eyes glaze over. Fortunately, the audience had quite a few data structure wonks this time. The audience asked some pretty insightful questions and pushed Reini on the explanations, until we understood his trade-offs.

We had 7 people attending this month. As always, we'd like to thank cPanel, Inc. for providing the meeting space and food for the group.