NAME

Basic::Types::XS - The great new Basic::Types::XS!

VERSION

Version 0.04

SYNOPSIS

use Basic::Types::XS qw/Str/;

Str->("abc");

Str->({ a => 1 }); # dies

EXPORT

Any

Defined

Bool

Str

Num

Int

Ref

ScalarRef

ArrayRef

HashRef

CodeRef

RegexpRef

GlobRef

METHODS

validate

BENCHMARK

The following benchmark is between Types::Standard with Type::Tiny::XS installed and Basic::Types::XS.

use Benchmark qw(:all :hireswallclock);
use Types::Standard;
use Basic::Types::XS;

my $r = timethese(1000000, {
	'Basic::Types::XS' => sub {
		my $Str = Basic::Types::XS::Str->('123');
		my $Num = Basic::Types::XS::Num->(123);
		my $Int = Basic::Types::XS::Int->(123);
		my $Array = Basic::Types::XS::ArrayRef->([qw/1 2 3/]);
		my $Hash = Basic::Types::XS::HashRef->({ a => 1, });
		my $Code = Basic::Types::XS::CodeRef->(sub { return 1 });
	},
	'Types::Standard' => sub {
		my $Str = Types::Standard::Str->('123');
		my $Num = Types::Standard::Num->(123);
		my $Int = Types::Standard::Int->(123);
		my $Array = Types::Standard::ArrayRef->([qw/1 2 3/]);
		my $Hash = Types::Standard::HashRef->({ a => 1, });
		my $Code = Types::Standard::CodeRef->(sub { return 1 });
	},
});


Benchmark: timing 1000000 iterations of Basic::Types::XS, Types::Standard...
Basic::Types::XS: 2.22538 wallclock secs ( 2.20 usr +  0.04 sys =  2.24 CPU) @ 446428.57/s (n=1000000)
Types::Standard: 3.23532 wallclock secs ( 3.23 usr +  0.00 sys =  3.23 CPU) @ 309597.52/s (n=1000000)
		     Rate  Types::Standard Basic::Types::XS
Types::Standard  309598/s               --             -31%
Basic::Types::XS 446429/s              44%               --

AUTHOR

LNATION, <email at lnation.org>

BUGS

Please report any bugs or feature requests to bug-basic-types-xs at rt.cpan.org, or through the web interface at https://rt.cpan.org/NoAuth/ReportBug.html?Queue=Basic-Types-XS. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

SUPPORT

You can find documentation for this module with the perldoc command.

perldoc Basic::Types::XS

You can also look for information at:

ACKNOWLEDGEMENTS

LICENSE AND COPYRIGHT

This software is Copyright (c) 2025 by LNATION.

This is free software, licensed under:

The Artistic License 2.0 (GPL Compatible)