Skip Menu |

This queue is for tickets about the Data-Check-Structure CPAN distribution.

Report information
The Basics
Id: 97336
Status: resolved
Priority: 0/
Queue: Data-Check-Structure

People
Owner: Nobody in particular
Requestors: perl [...] toby.ink
Cc:
AdminCc:

Bug Information
Severity: Unimportant
Broken in: (no value)
Fixed in: (no value)



Subject: Could be made faster
The following benchmarks at about twice the speed of your current is_aos implementation, for a simple case of: is_aos([1..10]) Here it is: use 5.010001; use strict; use warnings; use constant HAS_TYPES_STANDARD => !!eval( "use Types::Standard 0.046; use Type::Tiny::XS 0.003; 1" ); sub is_aos { my ($data, $opts) = @_; $opts //= {}; my $max = $opts->{max}; if (HAS_TYPES_STANDARD and not defined $max) { state $cc = Types::Standard::ArrayRef ->of(Types::Standard::Value) ->compiled_check; return $cc->($data); } return 0 unless ref($data) eq 'ARRAY'; for my $i (0..@$data-1) { last if defined($max) && $i >= $max; return 0 if ref($data->[$i]); } 1; }
Wait until I implement is_*() in XS :-) Regards, Steven
On Fri, 18 Jul 2014 13:42:39 GMT, SHARYANTO wrote: Show quoted text
> Wait until I implement is_*() in XS :-) > > Regards, > Steven
Closing for now, no plan in the new future to implement this.