user-pic

Diab Jerius

  • Commented on Relief from Regexes
    I'm a big fan of rxrx, which is part of Damian Conway's Regexp::Debugger package. A downside is the lack of command line history, but that can be dealt with using rlwrap. For those who haven't seen it in action, it...
  • Commented on Keep yer notes
    Here's another for your notes binder: perlsecret...
  • Commented on Extracting values from a list of (key, value) pairs
    @Graham Knop: I've fixed the code; thanks. @Aristotle: It actually seems to slow it down by a bit. Sequential runs with with your suggestion implemented, followed by the original code give: with: 1002/s 1016/s original: 1049/s 1075/s The difference between...
  • Commented on Extracting values from a list of (key, value) pairs
    @QM: You've raised some good points. Yes, @k would have been a better choice than @v. My mistake. I'd fix the code, but then your comment would have no context. Why a short variable name? The focus here is on...
  • Commented on Extracting values from a list of (key, value) pairs
    And just for completeness, I added direct assignment into the target array (idxa). As might be expected, it's significantly slower than pushing onto the end of the array (idxp)....
  • Commented on Extracting values from a list of (key, value) pairs
    Thanks for adding that to List::Util. Peeking at your code led me to realize I'd forgotten to add straightforward array indexing. It's surprisingly fast. XS still wins, though....
  • Commented on Extracting values from a list of (key, value) pairs
    A colleague pointed out I'd left out toggling using exclusive or; I've added that....
  • Posted Extracting values from a list of (key, value) pairs to Diab Jerius

    If you need ordered key, value pairs, you can either use something like Tie::IxHash or a simple array of key, value pairs.

    There are a number of…

  • Posted Automating POD previewing to Diab Jerius

    I find it difficult to review documentation written in a markup language. I need to see that final pretty rendition of it as a manual page, PDF file or HTML web page before I can get a feeling if the thing makes sense. I also like to see that final rendition while I'm writing the document,…

  • Commented on Tool tip: looking at a module's source
    My favorite: cpandoc -m...
  • Commented on p5-mop, a gentle introduction
    I am concerned by the loss of 'undef' as a value for attributes. One of the benefits of having it is that it actually has intrinsic meaning. For example (pardon the pseudo-code) let's say that class Foo's constructor accepts an...
  • Posted Perl and Perl Module Administration in the Modern Era to Diab Jerius

    I recently gave a talk on perlbrew, cpanminus,…

  • Posted Building pluggable backends with Moo to Diab Jerius

    I've been working through the design and implementation (using which implements some backend functionality via plugins. The nature of the module isn't that important; suffice it to say that there's a rendering backen…

  • Commented on Params::Validate::Dependencies
    Nice. I submitted a patch to P::V a few years back to add mutually exclusive parameters (see bug 5701) but it wasn't accepted; would you be able to incorporate some of those ideas in your work?...
Subscribe to feed Recent Actions from Diab Jerius

  • QM commented on Extracting values from a list of (key, value) pairs

    Nice work. pairkey is 4x faster than splice.

    Why do the keys get assigned into a variable called @v? That seems contrary, when it should be @k. (Also, just write out @values or @keys. I don't know how many times I've cursed people in modern languages who program like Basic was still the rage, with single letter variables.)

    The barrier to entry is rather high for the novice Perler here. Perhaps you can explain why you need a flat array, instead of some other structure? Or why speed trumps readability and maintainability?

    There are no comments in the code, so I have to …

  • QM commented on Extracting values from a list of (key, value) pairs

    I noticed that I can't submit from preview, I have to back up and submit there.

  • Graham Knop commented on Extracting values from a list of (key, value) pairs

    There is a small mistake in your code. @N has an odd number of elements. pairkeys will warn about this if warnings are on.

    Another option for this is doing an array slice:

    @N[ map $_*2, 0..(@N/2)-1 ]
    It's slower than several other options though.

  • Aristotle commented on Extracting values from a list of (key, value) pairs

    I wonder how idxa performs if you add a $#v = $#N / 2; before the loop.

  • mascip commented on Extracting values from a list of (key, value) pairs

    Have you tried Var::Pairs, written by Damian Conway? It doesn't have a subroutine to extract all keys, but it's very god for loops:

    for my $next (pairs @array) {
    say $next->index, ' has the value ', $next->value;
    }

Subscribe to feed Responses to Comments from Diab Jerius

About blogs.perl.org

blogs.perl.org is a common blogging platform for the Perl community. Written in Perl and offering the modern features you’ve come to expect in blog platforms, the site is run by Dave Cross and Aaron Crane, with a design donated by Six Apart, Ltd.