perltext - Perl Text thoughts
This document assumes you have read perlunitut, which in turn assumes you understand the distinction between characters and octets, and that a "string" is a sequence of characters (aka codepoints).
| #!/usr/bin/env perl | |
| use v5.40; use warnings; | |
| use Syntax::Keyword::Match; | |
| use OpenGL ':all'; | |
| use PDL; | |
| use PDL::Constants qw'PI E I'; | |
| use PDL::Transform; | |
| use Time::HiRes qw'gettimeofday tv_interval'; | |
| use IPC::Open2 'open2'; |
| $each = 1e7; $q = int(1e8/$each); with_time { PDL->random($each) for 1..$q } | |
| set_autopthread_size(0) | |
| $each approx time | |
| 1e8 1000ms | |
| 1e7 1050ms | |
| 1e6 700ms | |
| 1e5 740ms | |
| 1e4 2500ms |
| use strict; | |
| use warnings; | |
| use Time::HiRes qw(time); | |
| my ($SPARSEX, $SPARSEY) = (1100, 1); | |
| my $DIMS = 50000; | |
| sub set2 { | |
| my ($m) = @_; | |
| for my $y (0..int($DIMS / $SPARSEY)) { |
| use 5.012; | |
| use Benchmark qw( cmpthese timethese ); | |
| use Test::Deep::NoTest; | |
| use Scalar::Util qw(looks_like_number); | |
| use Params::Validate qw(SCALAR HASHREF ARRAYREF); | |
| my @SIG = ( | |
| { type => SCALAR, callbacks => { looks_like_number => sub { looks_like_number($_[0]) } } }, | |
| { type => HASHREF }, |
| I have the 8 Ball in my back pocket. I figure that makes me kind of a defense contractor. And I ought to get paid like one, meaning grossly overpaid. -- Richard Kadrey: Kill City Blues | |
| There's only one way to avoid criticism: do nothing, say nothing, be nothing. -- Aristotle | |
| Two possibilities exist: Either we are alone in the Universe, or we are not. Both are equally terrifying. -- Arthur C. Clarke | |
| History is a set of lies agreed upon. -- Napoleon Bonaparte | |
| The only time the word "incorrectly" isn't spelled incorrectly is when it's spelled incorrectly. | |
| Back when PHP had less than 100 functions, the function hashing mechanism was strlen(). In order to get a nice hash distribution of function names across the various function name lengths, names were picked specifically to make them fit into a specific length bucket. -- Rasmus Lerdorf | |
| <Raborn> I just read a book about Stockholm Syndrome. It was pretty bad at first, but by the end I kinda liked it. | |
| What language do deaf people think in? | |
| "A five-tailed fox!" Owen |
perltext - Perl Text thoughts
This document assumes you have read perlunitut, which in turn assumes you understand the distinction between characters and octets, and that a "string" is a sequence of characters (aka codepoints).