user-pic

Toby Inkster

  • Website: toby.ink/
  • About: I'm tobyink on CPAN, IRC and PerlMonks.
  • Commented on Match Anything, Quickly
    Type::Tiny's grep method should be pretty fast to filter a list of strings in most cases. use Types::Standard -types; use Types::Common::String -types; # null filter: @filtered = Any->grep( @strings ); # filters which do things: @filtered = NonEmptyStr->grep( @strings );...
  • Commented on Mite: an OO compiler for Perl
    There's a ticket on the issue tracker for a Dist::Zilla plugin. I'm unlikely to implement it myself, but would certainly accept one....
  • Commented on Smart Match in CPAN
    If porting code to not use ~~, then match::smart provides a very similar matching function....
  • Posted Mite: an OO compiler for Perl to Toby Inkster
  • Commented on A (not so) simple matter of privacy
    method $do_internal () { ...; } has been supported by Zydeco for over a year. documentation....
  • Commented on Addressing CPAN vulnerabilities related to checksums
    A while back, I started providing PGP/GPG signatures for all my CPAN and BackPAN releases here. Obviously, this doesn't help with people using the CPAN client to automatically download and install packages, but might be useful if anybody wants to...
  • Commented on Monthly Report - June
    CodersRank can be crazy. My score goes up and down quite dramatically for seemingly no reason. You're often ahead of me....
  • Commented on I failed to pause before blogging
    I think the indexer probably goes through line by line to avoid slurping in the whole file....
  • Commented on I found the truth about GameStop, Qanon, the Biden adminstration, and the British Royal Family
    Aliens from Mars killed Lee Harvey Oswald to hide the truth that eating Kraft instant mac and cheese boxes causes obesity. Lee Harvey Oswald found out because they were the source of all knowledge. Aliens from the moon know the...
  • Commented on Mood Lighting
    The way I currently have it, one cycle takes about 20 minutes; it's very subtle and slow, so a video would not be especially interesting. I'll try filming a faster sequence with more contrast between the colours though....
  • Posted Mood Lighting to Toby Inkster

    The lighting in my bedroom uses Philips Hue bulbs — specifically, the coloured ones. Last night, I decided it would be nice to set the three lights in my bedroom to cycle slowly through a set of warm colours using a script.

    I didn't…

  • Commented on Perl weekly challenge 95
    Your initial function can be simplified further. sub is_palindrome_rev { $_[0] eq reverse $_[0] } Any time you have something like: if ( X ) { return true; } else { return false; } That should trigger your code smell...
  • Commented on A Static Archive of rt.cpan.org
    Also click on the "URI-duri" link from https://rt-cpan.github.io/Public/Dist/ByMaintainer/TOBYINK/...
  • Commented on A Static Archive of rt.cpan.org
    Some issues seem missing. If you look at https://rt-cpan.github.io/Public/Dist/Type-Tiny/Active/ then try clicking on the links. The first one is broken, but the others work....
  • Commented on Drawing a blank with XS
    Python: Let's make whitespace characters syntactically signicifant. Perl: Hold my beer and watch this!...
  • Commented on Perl dying? Well now I don't care
    (If it was unclear in my previous comment, the "Yes" was supposed to be alt text for the image, to be displayed if the image cannot be shown.)...
  • Commented on Perl dying? Well now I don't care
    I can understand the push back on YAML. YAML is a huge specification, way more complex than you need. There's already a cut-back broken implementation in core, adding a second cut-back broken implementation seems a bad idea, and adding a...
  • Commented on Bill & Ted's Bogus Journey
    There's a lot of variation in how CPAN testers have their machines set up, so I can't say for sure if there's any way of getting output from them which will always work, but it seems to work pretty reliably....
  • Commented on Bill & Ted's Bogus Journey
    Yeah, I've seen in quite a few distributions the first test file will print out version numbers of dependencies. CPAN Testers will usually include version numbers of dependencies as part of their report, but that will not generally include optional...
  • Commented on CY's Take on PWC#088
    Why do this? my $pre_prod = 1; # short for "previous product" Why not just call the variable $previous_product? Sure, it's a little longer, but it's not that bad, and you'd actually make the code shorter overall because you could...
  • Commented on I founded a company called Perl Research Institute, Ltd.
    Looks interesting from what Google Translate is able to show me!...
  • Posted Thank You, Coveralls.io to Toby Inkster

    For letting me know my test coverage has increased by 0.00006%.

    (Seriously it's a pretty cool service though.…

  • Commented on Perl Weekly Challenge 085
    Ohhh, it means "to the power of". ^ is usually bitwise xor in Perl....
  • Commented on Perl Weekly Challenge 085
    Can't all non-negative integers be represented as a^b? If so, here's a Perl script to do task 2: print "1\n";...
  • Commented on Perl Weekly Challenge 084
    This: my @newlist = map { BLOCK } @oldlist; Is basically just a shortcut for: my @newlist = (); for my $item ( @oldlist ) { local $_ = $item; my @got = do { BLOCK }; push @newlist, @got;...
  • Posted Finding Squares in Matrices to Toby Inkster

    I don't usually take part in the Perl Weekly Challenge but one of this week's challenges caught my eye. I thought it could be a fun thing to attempt and decided to use Zydeco to help solve it.

  • Commented on Perl Weekly Challenge 084
    Parsing the input matrix can be made a lot simpler. my @matrix = map [/([01])/g], grep /[01]/, <$fh>;...
  • Commented on Adventures in Perl
    Welcome to the site! Sometimes if you want to eke out the last drop of performance from Perl, it can mean sacrificing readability, so looking at code from contests that reward performance, brevity, etc can give a bad impression of...
  • Commented on Perl Weekly Challenge 81: Frequency Sort
    This is why I like the list util modules. https://gist.github.com/tobyink/240252f3120b7e3f29a1337361285074...
  • Commented on Week #080: Smallest Positive Number & Count Candies
    perl -MZ -E'my @N = (1,8,-1); $_ = 1; while () { match($_, \@N) ? ++$_ : (say,last) }'...
Subscribe to feed Recent Actions from Toby Inkster

  • Nerdvana commented on Match Anything, Quickly

    I ran into the same thing while developing Language::FormulaEngine::Parser. After some testing, I found that eval-ing the function that contained the regexes yielded a huge speedup vs. trying to iterate qr// objects. I thought it had more to do with the loop vs. inlining the series of regex comparisons though. I never considered that a single qr// match might be slower than a single inline regex match.

  • Nerdvana commented on Match Anything, Quickly

    Hi, Cincinnati perlmongers had a chat about this and we realized that you forgot /smx on the sub-eval'd version. Fixing that, it still shows that eval'd sub is faster than regexref, but reveals that (*ACCEPT) is the slowest way to "match anything" in both situations.

    We also found out that qr/$re/o fixes most of the performance problem of using qr//, and are currently debating whether /o can cause bugs when used this way.

  • Deven commented on Match Anything, Quickly

    Actually, the /o flag needed to be on the match itself to speed it up, not the qr// expression.

    The original code wasn't a valid test because the subroutine versions of the test cases were missing the /smx flags shown in the output, so they were all failing to match a space character immediately. They weren't matching successfully, so it wasn't a fair comparison.

    Here's the test cases for an apples-to-apples test using /o to compile the match regex once and code references on both sides to minimize differences:

  • Tom Wyant commented on Match Anything, Quickly

    Boy, am I embarrassed. Thanks for picking up on the missing /smx. I did proofread, but obviously not enough.

  • Deven commented on Match Anything, Quickly

    Easy mistake to make! I never noticed it until I added extra code to print the results of the matches and discovered that the subs never matched!

    Your basic point still stands though -- without using /o when calling a qr// regex, it is several times slower than using the anonymous subroutine...

Subscribe to feed Responses to Comments from Toby Inkster

About blogs.perl.org

blogs.perl.org is a common blogging platform for the Perl community. Written in Perl with a graphic design donated by Six Apart, Ltd.