| Filename | /Users/ether/.perlbrew/libs/36.0@std/lib/perl5/Type/Tiny.pm |
| Statements | Executed 56865 statements in 105ms |
| Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
|---|---|---|---|---|---|
| 638 | 23 | 9 | 11.6ms | 60.7ms | Type::Tiny::inline_check (recurses: max depth 4, inclusive time 45.1ms) |
| 703 | 2 | 1 | 10.0ms | 34.1ms | Type::Tiny::is_strictly_subtype_of (recurses: max depth 7, inclusive time 61.1ms) |
| 3756 | 12 | 4 | 7.73ms | 9.48ms | Type::Tiny::isa |
| 1026 | 21 | 9 | 7.55ms | 12.1ms | Type::Tiny::can_be_inlined (recurses: max depth 2, inclusive time 710µs) |
| 794 | 3 | 2 | 6.79ms | 17.8ms | Type::Tiny::strictly_equals |
| 137 | 3 | 2 | 6.40ms | 58.6ms | Type::Tiny::inline_assert |
| 1691 | 4 | 1 | 5.96ms | 14.0ms | Type::Tiny::_loose_to_TypeTiny |
| 1 | 1 | 1 | 4.41ms | 4.76ms | Type::Tiny::BEGIN@21 |
| 54 | 1 | 1 | 3.47ms | 13.9ms | Type::Tiny::_build_coercion (recurses: max depth 2, inclusive time 3.06ms) |
| 82 | 7 | 6 | 3.43ms | 6.31ms | Type::Tiny::new |
| 1551 | 7 | 1 | 3.33ms | 4.38ms | Type::Tiny::_is_null_constraint |
| 69 | 1 | 1 | 2.86ms | 76.8ms | Type::Tiny::parameterize |
| 191 | 10 | 3 | 2.66ms | 44.8ms | Type::Tiny::is_strictly_a_type_of |
| 1 | 1 | 1 | 2.36ms | 2.71ms | Type::Tiny::__ANON__[:126] |
| 3648 | 12 | 1 | 2.23ms | 2.23ms | Type::Tiny::has_parent |
| 2032 | 18 | 10 | 2.19ms | 2.19ms | Type::Tiny::CORE:match (opcode) |
| 372 | 10 | 3 | 2.07ms | 3.11ms | Type::Tiny::__ANON__[:100] (recurses: max depth 1, inclusive time 9µs) |
| 220 | 2 | 1 | 1.73ms | 41.6ms | Type::Tiny::_overload_coderef |
| 38 | 2 | 2 | 1.18ms | 32.0ms | Type::Tiny::exportables |
| 69 | 1 | 1 | 1.16ms | 4.22ms | Type::Tiny::____make_key |
| 62 | 3 | 2 | 1.10ms | 21.2ms | Type::Tiny::_build_compiled_check |
| 1551 | 1 | 1 | 1.04ms | 1.05ms | Type::Tiny::constraint |
| 381 | 2 | 2 | 939µs | 3.66ms | Type::Tiny::check |
| 83 | 2 | 1 | 887µs | 1.04ms | Type::Tiny::_stringify_no_magic |
| 183 | 7 | 3 | 811µs | 25.5ms | Type::Tiny::__ANON__[:89] |
| 1139 | 12 | 3 | 680µs | 680µs | Type::Tiny::parent |
| 804 | 1 | 1 | 541µs | 541µs | Type::Tiny::has_inlined |
| 372 | 1 | 1 | 524µs | 730µs | Type::Tiny::display_name (recurses: max depth 1, inclusive time 1µs) |
| 106 | 2 | 2 | 451µs | 643µs | Type::Tiny::is_parameterizable |
| 129 | 3 | 2 | 439µs | 565µs | Type::Tiny::is_anon |
| 169 | 10 | 4 | 423µs | 22.3ms | Type::Tiny::compiled_check (recurses: max depth 1, inclusive time 24µs) |
| 529 | 1 | 1 | 388µs | 388µs | Type::Tiny::inlined |
| 67 | 3 | 3 | 380µs | 487µs | Type::Tiny::can |
| 85 | 7 | 6 | 373µs | 2.83ms | Type::Tiny::has_coercion (recurses: max depth 2, inclusive time 723µs) |
| 27 | 3 | 2 | 332µs | 3.01ms | Type::Tiny::create_child_type |
| 16 | 2 | 2 | 313µs | 827µs | Type::Tiny::__ANON__[:524] |
| 245 | 14 | 6 | 310µs | 310µs | Type::Tiny::__ANON__[:101] |
| 297 | 5 | 2 | 308µs | 308µs | Type::Tiny::name |
| 3 | 1 | 1 | 257µs | 4.84ms | Type::Tiny::__ANON__[:659] |
| 46 | 3 | 3 | 247µs | 294µs | Type::Tiny::qualified_name |
| 30 | 1 | 1 | 219µs | 237µs | Type::Tiny::__ANON__[:276] |
| 58 | 6 | 3 | 198µs | 14.0ms | Type::Tiny::coercion (recurses: max depth 2, inclusive time 3.08ms) |
| 106 | 1 | 1 | 192µs | 192µs | Type::Tiny::has_constraint_generator |
| 103 | 2 | 2 | 185µs | 185µs | Type::Tiny::deprecated |
| 3 | 1 | 1 | 160µs | 1.36ms | Type::Tiny::__ANON__[:1073] |
| 137 | 2 | 1 | 147µs | 147µs | Type::Tiny::CORE:sort (opcode) |
| 8 | 8 | 5 | 132µs | 132µs | Type::Tiny::_install_overloads |
| 44 | 1 | 1 | 131µs | 191µs | Type::Tiny::_build_display_name |
| 12 | 2 | 1 | 107µs | 143µs | Type::Tiny::_lookup_my_method (recurses: max depth 1, inclusive time 27µs) |
| 1 | 1 | 1 | 106µs | 106µs | Type::Tiny::BEGIN@29 |
| 33 | 1 | 1 | 106µs | 345µs | Type::Tiny::CORE:subst (opcode) |
| 43 | 5 | 5 | 103µs | 103µs | Type::Tiny::__ANON__[:55] |
| 17 | 6 | 2 | 102µs | 114µs | Type::Tiny::type_default (recurses: max depth 1, inclusive time 6µs) |
| 6 | 2 | 1 | 80µs | 416µs | Type::Tiny::AUTOLOAD |
| 3 | 1 | 1 | 64µs | 4.97ms | Type::Tiny::__ANON__[:602] |
| 2 | 1 | 1 | 56µs | 68µs | Type::Tiny::find_parent |
| 54 | 2 | 1 | 56µs | 56µs | Type::Tiny::has_coercion_generator |
| 34 | 1 | 1 | 53µs | 53µs | Type::Tiny::constraint_generator |
| 22 | 2 | 2 | 50µs | 68µs | Type::Tiny::name_generator |
| 20 | 1 | 1 | 46µs | 46µs | Type::Tiny::inline_generator |
| 1 | 1 | 1 | 44µs | 44µs | Type::Tiny::BEGIN@3 |
| 5 | 5 | 2 | 34µs | 1.47ms | Type::Tiny::where |
| 27 | 1 | 1 | 29µs | 29µs | Type::Tiny::child_type_class |
| 18 | 1 | 1 | 26µs | 28µs | Type::Tiny::my_methods |
| 20 | 1 | 1 | 22µs | 22µs | Type::Tiny::has_inline_generator |
| 1 | 1 | 1 | 20µs | 27µs | Type::Tiny::DESTROY |
| 2 | 1 | 1 | 20µs | 34µs | Type::Tiny::type_parameter |
| 1 | 1 | 1 | 18µs | 31µs | Type::Tiny::BEGIN@1435 |
| 5 | 1 | 1 | 18µs | 18µs | Type::Tiny::_build_name_generator |
| 5 | 2 | 2 | 18µs | 18µs | Type::Tiny::parameters |
| 15 | 1 | 1 | 17µs | 17µs | Type::Tiny::_build_constraint |
| 3 | 1 | 1 | 16µs | 4.98ms | Type::Tiny::is_a_type_of |
| 1 | 1 | 1 | 12µs | 34µs | Type::Tiny::BEGIN@4 |
| 6 | 2 | 1 | 12µs | 27µs | Type::Tiny::find_constraining_type |
| 1 | 1 | 1 | 11µs | 65µs | Type::Tiny::BEGIN@5 |
| 1 | 1 | 1 | 11µs | 605µs | Type::Tiny::exportables_by_tag |
| 1 | 1 | 1 | 10µs | 49µs | Type::Tiny::BEGIN@20 |
| 3 | 1 | 1 | 6µs | 10µs | Type::Tiny::is_parameterized |
| 1 | 1 | 1 | 5µs | 5µs | Type::Tiny::BEGIN@7 |
| 1 | 1 | 1 | 5µs | 12µs | Type::Tiny::BEGIN@71 |
| 3 | 1 | 1 | 5µs | 5µs | Type::Tiny::coercion_generator |
| 1 | 1 | 1 | 4µs | 4µs | Type::Tiny::BEGIN@11 |
| 3 | 1 | 1 | 4µs | 4µs | Type::Tiny::has_parameters |
| 1 | 1 | 1 | 3µs | 18µs | Type::Tiny::BEGIN@72 |
| 2 | 1 | 1 | 2µs | 2µs | Type::Tiny::_build_my_methods |
| 1 | 1 | 1 | 1µs | 1µs | Type::Tiny::_swap |
| 0 | 0 | 0 | 0s | 0s | Type::Tiny::DOES |
| 0 | 0 | 0 | 0s | 0s | Type::Tiny::TIEARRAY |
| 0 | 0 | 0 | 0s | 0s | Type::Tiny::TIEHASH |
| 0 | 0 | 0 | 0s | 0s | Type::Tiny::TIESCALAR |
| 0 | 0 | 0 | 0s | 0s | Type::Tiny::__ANON__[:1110] |
| 0 | 0 | 0 | 0s | 0s | Type::Tiny::__ANON__[:1114] |
| 0 | 0 | 0 | 0s | 0s | Type::Tiny::__ANON__[:1147] |
| 0 | 0 | 0 | 0s | 0s | Type::Tiny::__ANON__[:1219] |
| 0 | 0 | 0 | 0s | 0s | Type::Tiny::__ANON__[:1395] |
| 0 | 0 | 0 | 0s | 0s | Type::Tiny::__ANON__[:1410] |
| 0 | 0 | 0 | 0s | 0s | Type::Tiny::__ANON__[:150] |
| 0 | 0 | 0 | 0s | 0s | Type::Tiny::__ANON__[:151] |
| 0 | 0 | 0 | 0s | 0s | Type::Tiny::__ANON__[:152] |
| 0 | 0 | 0 | 0s | 0s | Type::Tiny::__ANON__[:1530] |
| 0 | 0 | 0 | 0s | 0s | Type::Tiny::__ANON__[:153] |
| 0 | 0 | 0 | 0s | 0s | Type::Tiny::__ANON__[:154] |
| 0 | 0 | 0 | 0s | 0s | Type::Tiny::__ANON__[:158] |
| 0 | 0 | 0 | 0s | 0s | Type::Tiny::__ANON__[:159] |
| 0 | 0 | 0 | 0s | 0s | Type::Tiny::__ANON__[:163] |
| 0 | 0 | 0 | 0s | 0s | Type::Tiny::__ANON__[:164] |
| 0 | 0 | 0 | 0s | 0s | Type::Tiny::__ANON__[:165] |
| 0 | 0 | 0 | 0s | 0s | Type::Tiny::__ANON__[:166] |
| 0 | 0 | 0 | 0s | 0s | Type::Tiny::__ANON__[:167] |
| 0 | 0 | 0 | 0s | 0s | Type::Tiny::__ANON__[:171] |
| 0 | 0 | 0 | 0s | 0s | Type::Tiny::__ANON__[:195] |
| 0 | 0 | 0 | 0s | 0s | Type::Tiny::__ANON__[:321] |
| 0 | 0 | 0 | 0s | 0s | Type::Tiny::__ANON__[:335] |
| 0 | 0 | 0 | 0s | 0s | Type::Tiny::__ANON__[:484] |
| 0 | 0 | 0 | 0s | 0s | Type::Tiny::__ANON__[:511] |
| 0 | 0 | 0 | 0s | 0s | Type::Tiny::__ANON__[:516] |
| 0 | 0 | 0 | 0s | 0s | Type::Tiny::__ANON__[:553] |
| 0 | 0 | 0 | 0s | 0s | Type::Tiny::__ANON__[:569] |
| 0 | 0 | 0 | 0s | 0s | Type::Tiny::__ANON__[:823] |
| 0 | 0 | 0 | 0s | 0s | Type::Tiny::__ANON__[:82] |
| 0 | 0 | 0 | 0s | 0s | Type::Tiny::__ANON__[:83] |
| 0 | 0 | 0 | 0s | 0s | Type::Tiny::__is_parameterized |
| 0 | 0 | 0 | 0s | 0s | Type::Tiny::_actually_compile_type_constraint |
| 0 | 0 | 0 | 0s | 0s | Type::Tiny::_add_type_coercions |
| 0 | 0 | 0 | 0s | 0s | Type::Tiny::_as_string |
| 0 | 0 | 0 | 0s | 0s | Type::Tiny::_assert_coercion |
| 0 | 0 | 0 | 0s | 0s | Type::Tiny::_build_complementary_type |
| 0 | 0 | 0 | 0s | 0s | Type::Tiny::_build_default_message |
| 0 | 0 | 0 | 0s | 0s | Type::Tiny::_build_moose_type |
| 0 | 0 | 0 | 0s | 0s | Type::Tiny::_build_mouse_type |
| 0 | 0 | 0 | 0s | 0s | Type::Tiny::_build_util |
| 0 | 0 | 0 | 0s | 0s | Type::Tiny::_clone |
| 0 | 0 | 0 | 0s | 0s | Type::Tiny::_compiled_type_coercion |
| 0 | 0 | 0 | 0s | 0s | Type::Tiny::_compiled_type_constraint |
| 0 | 0 | 0 | 0s | 0s | Type::Tiny::_croak |
| 0 | 0 | 0 | 0s | 0s | Type::Tiny::_dd |
| 0 | 0 | 0 | 0s | 0s | Type::Tiny::_default_message |
| 0 | 0 | 0 | 0s | 0s | Type::Tiny::_failed_check |
| 0 | 0 | 0 | 0s | 0s | Type::Tiny::_has_xsub |
| 0 | 0 | 0 | 0s | 0s | Type::Tiny::_identity |
| 0 | 0 | 0 | 0s | 0s | Type::Tiny::_inline_check |
| 0 | 0 | 0 | 0s | 0s | Type::Tiny::_instantiate_moose_type |
| 0 | 0 | 0 | 0s | 0s | Type::Tiny::_perlcode |
| 0 | 0 | 0 | 0s | 0s | Type::Tiny::_process_coercion_list |
| 0 | 0 | 0 | 0s | 0s | Type::Tiny::_strict_check |
| 0 | 0 | 0 | 0s | 0s | Type::Tiny::_unite |
| 0 | 0 | 0 | 0s | 0s | Type::Tiny::assert_coerce |
| 0 | 0 | 0 | 0s | 0s | Type::Tiny::assert_return |
| 0 | 0 | 0 | 0s | 0s | Type::Tiny::assert_valid |
| 0 | 0 | 0 | 0s | 0s | Type::Tiny::coerce |
| 0 | 0 | 0 | 0s | 0s | Type::Tiny::coercibles |
| 0 | 0 | 0 | 0s | 0s | Type::Tiny::compile_type_constraint |
| 0 | 0 | 0 | 0s | 0s | Type::Tiny::complementary_type |
| 0 | 0 | 0 | 0s | 0s | Type::Tiny::deep_explanation |
| 0 | 0 | 0 | 0s | 0s | Type::Tiny::equals |
| 0 | 0 | 0 | 0s | 0s | Type::Tiny::get_message |
| 0 | 0 | 0 | 0s | 0s | Type::Tiny::hand_optimized_type_constraint |
| 0 | 0 | 0 | 0s | 0s | Type::Tiny::has_deep_explanation |
| 0 | 0 | 0 | 0s | 0s | Type::Tiny::has_hand_optimized_type_constraint |
| 0 | 0 | 0 | 0s | 0s | Type::Tiny::has_library |
| 0 | 0 | 0 | 0s | 0s | Type::Tiny::has_message |
| 0 | 0 | 0 | 0s | 0s | Type::Tiny::has_parameterized_from |
| 0 | 0 | 0 | 0s | 0s | Type::Tiny::has_sorter |
| 0 | 0 | 0 | 0s | 0s | Type::Tiny::inline_environment |
| 0 | 0 | 0 | 0s | 0s | Type::Tiny::is_strictly_supertype_of |
| 0 | 0 | 0 | 0s | 0s | Type::Tiny::is_subtype_of |
| 0 | 0 | 0 | 0s | 0s | Type::Tiny::is_supertype_of |
| 0 | 0 | 0 | 0s | 0s | Type::Tiny::library |
| 0 | 0 | 0 | 0s | 0s | Type::Tiny::message |
| 0 | 0 | 0 | 0s | 0s | Type::Tiny::meta |
| 0 | 0 | 0 | 0s | 0s | Type::Tiny::minus_coercions |
| 0 | 0 | 0 | 0s | 0s | Type::Tiny::moose_type |
| 0 | 0 | 0 | 0s | 0s | Type::Tiny::mouse_type |
| 0 | 0 | 0 | 0s | 0s | Type::Tiny::no_coercions |
| 0 | 0 | 0 | 0s | 0s | Type::Tiny::of |
| 0 | 0 | 0 | 0s | 0s | Type::Tiny::parameterized_from |
| 0 | 0 | 0 | 0s | 0s | Type::Tiny::parents |
| 0 | 0 | 0 | 0s | 0s | Type::Tiny::plus_coercions |
| 0 | 0 | 0 | 0s | 0s | Type::Tiny::plus_fallback_coercions |
| 0 | 0 | 0 | 0s | 0s | Type::Tiny::sorter |
| 0 | 0 | 0 | 0s | 0s | Type::Tiny::validate |
| 0 | 0 | 0 | 0s | 0s | Type::Tiny::validate_explain |
| 0 | 0 | 0 | 0s | 0s | Types::Standard::to_Any |
| 0 | 0 | 0 | 0s | 0s | Types::Standard::to_ArrayRef |
| 0 | 0 | 0 | 0s | 0s | Types::Standard::to_ClassName |
| 0 | 0 | 0 | 0s | 0s | Types::Standard::to_CodeRef |
| 0 | 0 | 0 | 0s | 0s | Types::Standard::to_ConsumerOf |
| 0 | 0 | 0 | 0s | 0s | Types::Standard::to_CycleTuple |
| 0 | 0 | 0 | 0s | 0s | Types::Standard::to_Defined |
| 0 | 0 | 0 | 0s | 0s | Types::Standard::to_Dict |
| 0 | 0 | 0 | 0s | 0s | Types::Standard::to_Enum |
| 0 | 0 | 0 | 0s | 0s | Types::Standard::to_FileHandle |
| 0 | 0 | 0 | 0s | 0s | Types::Standard::to_GlobRef |
| 0 | 0 | 0 | 0s | 0s | Types::Standard::to_HasMethods |
| 0 | 0 | 0 | 0s | 0s | Types::Standard::to_HashRef |
| 0 | 0 | 0 | 0s | 0s | Types::Standard::to_InstanceOf |
| 0 | 0 | 0 | 0s | 0s | Types::Standard::to_Int |
| 0 | 0 | 0 | 0s | 0s | Types::Standard::to_Item |
| 0 | 0 | 0 | 0s | 0s | Types::Standard::to_LaxNum |
| 0 | 0 | 0 | 0s | 0s | Types::Standard::to_Map |
| 0 | 0 | 0 | 0s | 0s | Types::Standard::to_Maybe |
| 0 | 0 | 0 | 0s | 0s | Types::Standard::to_Num |
| 0 | 0 | 0 | 0s | 0s | Types::Standard::to_Object |
| 0 | 0 | 0 | 0s | 0s | Types::Standard::to_OptList |
| 0 | 0 | 0 | 0s | 0s | Types::Standard::to_Optional |
| 0 | 0 | 0 | 0s | 0s | Types::Standard::to_Overload |
| 0 | 0 | 0 | 0s | 0s | Types::Standard::to_Ref |
| 0 | 0 | 0 | 0s | 0s | Types::Standard::to_RegexpRef |
| 0 | 0 | 0 | 0s | 0s | Types::Standard::to_RoleName |
| 0 | 0 | 0 | 0s | 0s | Types::Standard::to_ScalarRef |
| 0 | 0 | 0 | 0s | 0s | Types::Standard::to_Slurpy |
| 0 | 0 | 0 | 0s | 0s | Types::Standard::to_Str |
| 0 | 0 | 0 | 0s | 0s | Types::Standard::to_StrMatch |
| 0 | 0 | 0 | 0s | 0s | Types::Standard::to_StrictNum |
| 0 | 0 | 0 | 0s | 0s | Types::Standard::to_Tied |
| 0 | 0 | 0 | 0s | 0s | Types::Standard::to_Tuple |
| 0 | 0 | 0 | 0s | 0s | Types::Standard::to_Undef |
| 0 | 0 | 0 | 0s | 0s | Types::Standard::to_Value |
| Line | State ments |
Time on line |
Calls | Time in subs |
Code |
|---|---|---|---|---|---|
| 1 | package Type::Tiny; | ||||
| 2 | |||||
| 3 | 2 | 54µs | 1 | 44µs | # spent 44µs within Type::Tiny::BEGIN@3 which was called:
# once (44µs+0s) by Type::Library::BEGIN@16 at line 3 # spent 44µs making 1 call to Type::Tiny::BEGIN@3 |
| 4 | 2 | 92µs | 2 | 56µs | # spent 34µs (12+22) within Type::Tiny::BEGIN@4 which was called:
# once (12µs+22µs) by Type::Library::BEGIN@16 at line 4 # spent 34µs making 1 call to Type::Tiny::BEGIN@4
# spent 22µs making 1 call to strict::import |
| 5 | 2 | 50µs | 2 | 119µs | # spent 65µs (11+54) within Type::Tiny::BEGIN@5 which was called:
# once (11µs+54µs) by Type::Library::BEGIN@16 at line 5 # spent 65µs making 1 call to Type::Tiny::BEGIN@5
# spent 54µs making 1 call to warnings::import |
| 6 | |||||
| 7 | # spent 5µs within Type::Tiny::BEGIN@7 which was called:
# once (5µs+0s) by Type::Library::BEGIN@16 at line 9 | ||||
| 8 | 1 | 4µs | if ( $] < 5.010 ) { require Devel::TypeTiny::Perl58Compat } | ||
| 9 | 1 | 90µs | 1 | 5µs | } # spent 5µs making 1 call to Type::Tiny::BEGIN@7 |
| 10 | |||||
| 11 | # spent 4µs within Type::Tiny::BEGIN@11 which was called:
# once (4µs+0s) by Type::Library::BEGIN@16 at line 15 | ||||
| 12 | 1 | 0s | $Type::Tiny::AUTHORITY = 'cpan:TOBYINK'; | ||
| 13 | 1 | 0s | $Type::Tiny::VERSION = '2.000001'; | ||
| 14 | 1 | 11µs | $Type::Tiny::XS_VERSION = '0.016'; | ||
| 15 | 1 | 55µs | 1 | 4µs | } # spent 4µs making 1 call to Type::Tiny::BEGIN@11 |
| 16 | |||||
| 17 | 1 | 1µs | $Type::Tiny::VERSION =~ tr/_//d; | ||
| 18 | 1 | 1µs | $Type::Tiny::XS_VERSION =~ tr/_//d; | ||
| 19 | |||||
| 20 | 2 | 46µs | 2 | 88µs | # spent 49µs (10+39) within Type::Tiny::BEGIN@20 which was called:
# once (10µs+39µs) by Type::Library::BEGIN@16 at line 20 # spent 49µs making 1 call to Type::Tiny::BEGIN@20
# spent 39µs making 1 call to Exporter::import |
| 21 | 2 | 837µs | 1 | 4.76ms | # spent 4.76ms (4.41+353µs) within Type::Tiny::BEGIN@21 which was called:
# once (4.41ms+353µs) by Type::Library::BEGIN@16 at line 21 # spent 4.76ms making 1 call to Type::Tiny::BEGIN@21 |
| 22 | |||||
| 23 | 1 | 2µs | our $SafePackage = sprintf 'package %s;', __PACKAGE__; | ||
| 24 | |||||
| 25 | sub _croak ($;@) { require Error::TypeTiny; goto \&Error::TypeTiny::croak } | ||||
| 26 | |||||
| 27 | 1 | 3µs | # spent 1µs within Type::Tiny::_swap which was called:
# once (1µs+0s) by Type::Tiny::__ANON__[/Users/ether/.perlbrew/libs/36.0@std/lib/perl5/Type/Tiny.pm:126] at line 104 | ||
| 28 | |||||
| 29 | # spent 106µs within Type::Tiny::BEGIN@29 which was called:
# once (106µs+0s) by Type::Library::BEGIN@16 at line 66 | ||||
| 30 | 1 | 0s | my $support_smartmatch = 0+ !!( $] >= 5.010001 ); | ||
| 31 | 1 | 18µs | eval qq{ sub SUPPORT_SMARTMATCH () { !! $support_smartmatch } }; | ||
| 32 | |||||
| 33 | 1 | 0s | my $fixed_precedence = 0+ !!( $] >= 5.014 ); | ||
| 34 | 1 | 13µs | eval qq{ sub _FIXED_PRECEDENCE () { !! $fixed_precedence } }; | ||
| 35 | |||||
| 36 | my $try_xs = | ||||
| 37 | exists( $ENV{PERL_TYPE_TINY_XS} ) ? !!$ENV{PERL_TYPE_TINY_XS} | ||||
| 38 | : exists( $ENV{PERL_ONLY} ) ? !$ENV{PERL_ONLY} | ||||
| 39 | 1 | 1µs | : 1; | ||
| 40 | |||||
| 41 | 1 | 0s | my $use_xs = 0; | ||
| 42 | 1 | 0s | $try_xs and eval { | ||
| 43 | 1 | 69µs | require Type::Tiny::XS; | ||
| 44 | 'Type::Tiny::XS'->VERSION( $Type::Tiny::XS_VERSION ); | ||||
| 45 | $use_xs++; | ||||
| 46 | }; | ||||
| 47 | |||||
| 48 | *_USE_XS = | ||||
| 49 | $use_xs | ||||
| 50 | ? sub () { !!1 } | ||||
| 51 | 1 | 1µs | : sub () { !!0 }; | ||
| 52 | |||||
| 53 | *_USE_MOUSE = | ||||
| 54 | $try_xs | ||||
| 55 | 43 | 185µs | # spent 103µs within Type::Tiny::__ANON__[/Users/ether/.perlbrew/libs/36.0@std/lib/perl5/Type/Tiny.pm:55] which was called 43 times, avg 2µs/call:
# 20 times (45µs+0s) by Types::Standard::__ANON__[/Users/ether/.perlbrew/libs/36.0@std/lib/perl5/Types/Standard.pm:127] at line 74 of Types/Standard.pm, avg 2µs/call
# 10 times (24µs+0s) by Type::Tiny::Class::new at line 46 of Type/Tiny/Class.pm, avg 2µs/call
# 8 times (21µs+0s) by Types::Standard::HashRef::__constraint_generator at line 34 of Types/Standard/HashRef.pm, avg 3µs/call
# 4 times (9µs+0s) by Types::Standard::ArrayRef::__constraint_generator at line 38 of Types/Standard/ArrayRef.pm, avg 2µs/call
# once (4µs+0s) by Type::Tiny::Duck::new at line 47 of Type/Tiny/Duck.pm | ||
| 56 | 1 | 1µs | : sub () { !!0 }; | ||
| 57 | |||||
| 58 | 1 | 0s | my $strict_mode = 0; | ||
| 59 | 1 | 1µs | $ENV{$_} && ++$strict_mode for qw( | ||
| 60 | EXTENDED_TESTING | ||||
| 61 | AUTHOR_TESTING | ||||
| 62 | RELEASE_TESTING | ||||
| 63 | PERL_STRICT | ||||
| 64 | ); | ||||
| 65 | 1 | 3µs | *_STRICT_MODE = $strict_mode ? sub () { !!1 } : sub () { !!0 }; | ||
| 66 | 1 | 21µs | 1 | 106µs | } #/ BEGIN # spent 106µs making 1 call to Type::Tiny::BEGIN@29 |
| 67 | |||||
| 68 | { | ||||
| 69 | |||||
| 70 | # spent 132µs within Type::Tiny::_install_overloads which was called 8 times, avg 16µs/call:
# once (41µs+0s) by Type::Library::BEGIN@16 at line 168
# once (22µs+0s) by Type::Tiny::_build_coercion at line 29 of Type/Coercion.pm
# once (19µs+0s) by JSON::Schema::Modern::BEGIN@31 at line 161 of Types/Standard.pm
# once (15µs+0s) by Type::Tiny::__ANON__[/Users/ether/.perlbrew/libs/36.0@std/lib/perl5/Type/Tiny.pm:126] at line 23 of Type/Tiny/Union.pm
# once (10µs+0s) by Type::Library::BEGIN@16 at line 172
# once (9µs+0s) by Types::Standard::__ANON__[/Users/ether/.perlbrew/libs/36.0@std/lib/perl5/Types/Standard.pm:1059] at line 22 of Type/Tiny/Enum.pm
# once (9µs+0s) by JSON::Schema::Modern::BEGIN@31 at line 191 of Types/Standard.pm
# once (7µs+0s) by Type::Tiny::_build_coercion at line 34 of Type/Coercion.pm | ||||
| 71 | 2 | 25µs | 2 | 19µs | # spent 12µs (5+7) within Type::Tiny::BEGIN@71 which was called:
# once (5µs+7µs) by Type::Library::BEGIN@16 at line 71 # spent 12µs making 1 call to Type::Tiny::BEGIN@71
# spent 7µs making 1 call to strict::unimport |
| 72 | 2 | 7.53ms | 2 | 33µs | # spent 18µs (3+15) within Type::Tiny::BEGIN@72 which was called:
# once (3µs+15µs) by Type::Library::BEGIN@16 at line 72 # spent 18µs making 1 call to Type::Tiny::BEGIN@72
# spent 15µs making 1 call to warnings::unimport |
| 73 | |||||
| 74 | # Coverage is checked on Perl 5.26 | ||||
| 75 | 8 | 3µs | if ( $] < 5.010 ) { # uncoverable statement | ||
| 76 | require overload; # uncoverable statement | ||||
| 77 | push @_, fallback => 1; # uncoverable statement | ||||
| 78 | goto \&overload::OVERLOAD; # uncoverable statement | ||||
| 79 | } | ||||
| 80 | |||||
| 81 | 8 | 4µs | my $class = shift; | ||
| 82 | 8 | 35µs | *{ $class . '::((' } = sub { }; | ||
| 83 | 8 | 13µs | *{ $class . '::()' } = sub { }; | ||
| 84 | 24 | 12µs | *{ $class . '::()' } = do { my $x = 1; \$x }; | ||
| 85 | 8 | 42µs | while ( @_ ) { | ||
| 86 | 25 | 2µs | my $f = shift; | ||
| 87 | 25 | 40µs | *{ $class . '::(' . $f } = ref $_[0] ? shift : do { | ||
| 88 | 2 | 0s | my $m = shift; | ||
| 89 | 183 | 617µs | 183 | 24.7ms | # spent 25.5ms (811µs+24.7) within Type::Tiny::__ANON__[/Users/ether/.perlbrew/libs/36.0@std/lib/perl5/Type/Tiny.pm:89] which was called 183 times, avg 139µs/call:
# 72 times (310µs+3.48ms) by JSON::Schema::Modern::Document::__ANON__[/Users/ether/.perlbrew/libs/36.0@std/lib/perl5/JSON/Schema/Modern/Document.pm:135] or Sub::Defer::__ANON__[/Users/ether/.perlbrew/libs/36.0@std/lib/perl5/Sub/Defer.pm:178] at line 120 of JSON/Schema/Modern/Document.pm, avg 53µs/call
# 48 times (144µs+3.28ms) by JSON::Schema::Modern::__ANON__[/Users/ether/.perlbrew/libs/36.0@std/lib/perl5/JSON/Schema/Modern.pm:672] or Sub::Defer::__ANON__[/Users/ether/.perlbrew/libs/36.0@std/lib/perl5/Sub/Defer.pm:178] at line 646 of JSON/Schema/Modern.pm, avg 71µs/call
# 47 times (322µs+17.4ms) by Method::Generate::Accessor::_validate_codulatable at line 686 of Method/Generate/Accessor.pm, avg 378µs/call
# 10 times (14µs+6µs) by JSON::Schema::Modern::__ANON__[/Users/ether/.perlbrew/libs/36.0@std/lib/perl5/JSON/Schema/Modern.pm:124] or Sub::Defer::__ANON__[/Users/ether/.perlbrew/libs/36.0@std/lib/perl5/Sub/Defer.pm:178] at line 124 of JSON/Schema/Modern.pm, avg 2µs/call
# 2 times (7µs+225µs) by JSON::Schema::Modern::add_vocabulary or Sub::Defer::__ANON__[/Users/ether/.perlbrew/libs/36.0@std/lib/perl5/Sub/Defer.pm:178] at line 707 of JSON/Schema/Modern.pm, avg 116µs/call
# 2 times (8µs+221µs) by JSON::Schema::Modern::add_vocabulary or Sub::Defer::__ANON__[/Users/ether/.perlbrew/libs/36.0@std/lib/perl5/Sub/Defer.pm:178] at line 702 of JSON/Schema/Modern.pm, avg 114µs/call
# 2 times (6µs+1µs) by JSON::Schema::Modern::add_vocabulary or Sub::Defer::__ANON__[/Users/ether/.perlbrew/libs/36.0@std/lib/perl5/Sub/Defer.pm:178] at line 708 of JSON/Schema/Modern.pm, avg 4µs/call # spent 24.7ms making 183 calls to Type::Tiny::_overload_coderef, avg 135µs/call |
| 90 | 2 | 3µs | }; | ||
| 91 | } | ||||
| 92 | } #/ sub _install_overloads | ||||
| 93 | } | ||||
| 94 | |||||
| 95 | 1 | 0s | __PACKAGE__->_install_overloads( | ||
| 96 | # spent 3.11ms (2.07+1.03) within Type::Tiny::__ANON__[/Users/ether/.perlbrew/libs/36.0@std/lib/perl5/Type/Tiny.pm:100] which was called 372 times, avg 8µs/call:
# 73 times (448µs+164µs) by Type::Tiny::inline_assert at line 935, avg 8µs/call
# 64 times (362µs+281µs) by Type::Tiny::inline_assert at line 947, avg 10µs/call
# 48 times (415µs+287µs) by Type::Tiny::_build_compiled_check at line 537, avg 15µs/call
# 39 times (127µs+60µs) by Types::Standard::__ANON__[/Users/ether/.perlbrew/libs/36.0@std/lib/perl5/Types/Standard.pm:826] at line 823 of Types/Standard.pm, avg 5µs/call
# 37 times (227µs+37µs) by Type::Tiny::_overload_coderef at line 215, avg 7µs/call
# 37 times (162µs+91µs) by Type::Tiny::_build_coercion at line 502, avg 7µs/call
# 33 times (158µs+81µs) by Type::Tiny::CORE:subst at line 522, avg 7µs/call
# 33 times (140µs+29µs) by Type::Tiny::__ANON__[/Users/ether/.perlbrew/libs/36.0@std/lib/perl5/Type/Tiny.pm:524] at line 523, avg 5µs/call
# 6 times (27µs+10µs) by Types::Standard::__ANON__[/Users/ether/.perlbrew/libs/36.0@std/lib/perl5/Types/Standard.pm:786] at line 785 of Types/Standard.pm, avg 6µs/call
# 2 times (8µs+-8µs) by Type::Tiny::Union::_build_display_name at line 97 of Type/Tiny/Union.pm, avg 0s/call | ||||
| 97 | 372 | 2.25ms | 744 | 1.04ms | caller =~ m{^(Moo::HandleMoose|Sub::Quote)} # spent 731µs making 372 calls to Type::Tiny::display_name, avg 2µs/call, recursion: max depth 1, sum of overlapping time 1µs
# spent 310µs making 372 calls to Type::Tiny::CORE:match, avg 833ns/call |
| 98 | ? $_[0]->_stringify_no_magic | ||||
| 99 | : $_[0]->display_name; | ||||
| 100 | }, | ||||
| 101 | 245 | 568µs | # spent 310µs within Type::Tiny::__ANON__[/Users/ether/.perlbrew/libs/36.0@std/lib/perl5/Type/Tiny.pm:101] which was called 245 times, avg 1µs/call:
# 79 times (49µs+0s) by Type::Tiny::Class::parent at line 149 of Type/Tiny/Class.pm, avg 620ns/call
# 58 times (89µs+0s) by Type::Coercion::_preserve_type_constraint at line 111 of Type/Coercion.pm, avg 2µs/call
# 46 times (79µs+0s) by Method::Generate::Accessor::_generate_populate_set at line 567 of Method/Generate/Accessor.pm, avg 2µs/call
# 17 times (40µs+0s) by Method::Generate::Accessor::_generate_use_default at line 367 of Method/Generate/Accessor.pm, avg 2µs/call
# 10 times (16µs+0s) by Method::Generate::Accessor::is_simple_set at line 297 of Method/Generate/Accessor.pm, avg 2µs/call
# 10 times (9µs+0s) by Method::Generate::Accessor::_generate_set at line 410 of Method/Generate/Accessor.pm, avg 900ns/call
# 6 times (6µs+0s) by Type::Coercion::type_constraint at line 89 of Type/Coercion.pm, avg 1µs/call
# 4 times (5µs+0s) by Types::Standard::Slurpy::my_unslurpy at line 751 of Types/Standard.pm, avg 1µs/call
# 3 times (4µs+0s) by Types::Standard::Dict::__inline_generator at line 100 of Types/Standard/Dict.pm, avg 1µs/call
# 3 times (3µs+0s) by Types::Standard::__ANON__[/Users/ether/.perlbrew/libs/36.0@std/lib/perl5/Types/Standard.pm:826] at line 823 of Types/Standard.pm, avg 1µs/call
# 3 times (2µs+0s) by Types::Standard::Dict::__inline_generator at line 103 of Types/Standard/Dict.pm, avg 667ns/call
# 3 times (0s+0s) by Types::Standard::Dict::__inline_generator at line 96 of Types/Standard/Dict.pm, avg 0s/call
# 2 times (4µs+0s) by Type::Tiny::find_parent at line 743, avg 2µs/call
# once (4µs+0s) by Type::Tiny::type_default at line 573 | ||
| 102 | q(&{}) => "_overload_coderef", | ||||
| 103 | # spent 2.71ms (2.36+353µs) within Type::Tiny::__ANON__[/Users/ether/.perlbrew/libs/36.0@std/lib/perl5/Type/Tiny.pm:126] which was called:
# once (2.36ms+353µs) by JSON::Schema::Modern::BEGIN@33 at line 42 of JSON/Schema/Modern/Error.pm | ||||
| 104 | 1 | 2µs | 1 | 1µs | my @tc = _swap @_; # spent 1µs making 1 call to Type::Tiny::_swap |
| 105 | if ( !_FIXED_PRECEDENCE && $_[2] ) { | ||||
| 106 | if ( blessed $tc[0] ) { | ||||
| 107 | if ( blessed $tc[0] eq "Type::Tiny::_HalfOp" ) { | ||||
| 108 | my $type = $tc[0]->{type}; | ||||
| 109 | my $param = $tc[0]->{param}; | ||||
| 110 | my $op = $tc[0]->{op}; | ||||
| 111 | require Type::Tiny::Union; | ||||
| 112 | return "Type::Tiny::_HalfOp"->new( | ||||
| 113 | $op, | ||||
| 114 | $param, | ||||
| 115 | "Type::Tiny::Union"->new_by_overload( type_constraints => [ $type, $tc[1] ] ), | ||||
| 116 | ); | ||||
| 117 | } #/ if ( blessed $tc[0] eq...) | ||||
| 118 | } #/ if ( blessed $tc[0] ) | ||||
| 119 | elsif ( ref $tc[0] eq 'ARRAY' ) { | ||||
| 120 | require Type::Tiny::_HalfOp; | ||||
| 121 | return "Type::Tiny::_HalfOp"->new( '|', @tc ); | ||||
| 122 | } | ||||
| 123 | } #/ if ( !_FIXED_PRECEDENCE...) | ||||
| 124 | 1 | 548µs | require Type::Tiny::Union; | ||
| 125 | 1 | 5µs | 1 | 151µs | return "Type::Tiny::Union"->new_by_overload( type_constraints => \@tc ); # spent 151µs making 1 call to Type::Tiny::Union::new_by_overload |
| 126 | }, | ||||
| 127 | q(&) => sub { | ||||
| 128 | my @tc = _swap @_; | ||||
| 129 | if ( !_FIXED_PRECEDENCE && $_[2] ) { | ||||
| 130 | if ( blessed $tc[0] ) { | ||||
| 131 | if ( blessed $tc[0] eq "Type::Tiny::_HalfOp" ) { | ||||
| 132 | my $type = $tc[0]->{type}; | ||||
| 133 | my $param = $tc[0]->{param}; | ||||
| 134 | my $op = $tc[0]->{op}; | ||||
| 135 | require Type::Tiny::Intersection; | ||||
| 136 | return "Type::Tiny::_HalfOp"->new( | ||||
| 137 | $op, | ||||
| 138 | $param, | ||||
| 139 | "Type::Tiny::Intersection"->new_by_overload( type_constraints => [ $type, $tc[1] ] ), | ||||
| 140 | ); | ||||
| 141 | } #/ if ( blessed $tc[0] eq...) | ||||
| 142 | } #/ if ( blessed $tc[0] ) | ||||
| 143 | elsif ( ref $tc[0] eq 'ARRAY' ) { | ||||
| 144 | require Type::Tiny::_HalfOp; | ||||
| 145 | return "Type::Tiny::_HalfOp"->new( '&', @tc ); | ||||
| 146 | } | ||||
| 147 | } #/ if ( !_FIXED_PRECEDENCE...) | ||||
| 148 | require Type::Tiny::Intersection; | ||||
| 149 | "Type::Tiny::Intersection"->new_by_overload( type_constraints => \@tc ); | ||||
| 150 | }, | ||||
| 151 | q(~) => sub { shift->complementary_type }, | ||||
| 152 | q(==) => sub { $_[0]->equals( $_[1] ) }, | ||||
| 153 | q(!=) => sub { not $_[0]->equals( $_[1] ) }, | ||||
| 154 | q(<) => sub { my $m = $_[0]->can( 'is_subtype_of' ); $m->( _swap @_ ) }, | ||||
| 155 | q(>) => sub { | ||||
| 156 | my $m = $_[0]->can( 'is_subtype_of' ); | ||||
| 157 | $m->( reverse _swap @_ ); | ||||
| 158 | }, | ||||
| 159 | q(<=) => sub { my $m = $_[0]->can( 'is_a_type_of' ); $m->( _swap @_ ) }, | ||||
| 160 | q(>=) => sub { | ||||
| 161 | my $m = $_[0]->can( 'is_a_type_of' ); | ||||
| 162 | $m->( reverse _swap @_ ); | ||||
| 163 | }, | ||||
| 164 | q(eq) => sub { "$_[0]" eq "$_[1]" }, | ||||
| 165 | q(cmp) => sub { $_[2] ? ( "$_[1]" cmp "$_[0]" ) : ( "$_[0]" cmp "$_[1]" ) }, | ||||
| 166 | q(0+) => sub { $_[0]{uniq} }, | ||||
| 167 | q(/) => sub { ( _STRICT_MODE xor $_[2] ) ? $_[0] : $_[1] }, | ||||
| 168 | 1 | 27µs | 1 | 41µs | ); # spent 41µs making 1 call to Type::Tiny::_install_overloads |
| 169 | |||||
| 170 | __PACKAGE__->_install_overloads( | ||||
| 171 | q(~~) => sub { $_[0]->check( $_[1] ) }, | ||||
| 172 | 1 | 2µs | 1 | 10µs | ) if Type::Tiny::SUPPORT_SMARTMATCH; # spent 10µs making 1 call to Type::Tiny::_install_overloads |
| 173 | |||||
| 174 | # Would be easy to just return sub { $self->assert_return(@_) } | ||||
| 175 | # but try to build a more efficient coderef whenever possible. | ||||
| 176 | # | ||||
| 177 | # spent 41.6ms (1.73+39.8) within Type::Tiny::_overload_coderef which was called 220 times, avg 189µs/call:
# 183 times (780µs+23.9ms) by Type::Tiny::__ANON__[/Users/ether/.perlbrew/libs/36.0@std/lib/perl5/Type/Tiny.pm:89] at line 89, avg 135µs/call
# 37 times (953µs+15.9ms) by Type::Tiny::exportables at line 1209, avg 457µs/call | ||||
| 178 | 220 | 27µs | my $self = shift; | ||
| 179 | |||||
| 180 | # Bypass generating a coderef if we've already got the best possible one. | ||||
| 181 | # | ||||
| 182 | 220 | 424µs | return $self->{_overload_coderef} if $self->{_overload_coderef_no_rebuild}; | ||
| 183 | |||||
| 184 | # Subclasses of Type::Tiny might override assert_return to do some kind | ||||
| 185 | # of interesting thing. In that case, we can't rely on it having identical | ||||
| 186 | # behaviour to Type::Tiny::inline_assert. | ||||
| 187 | # | ||||
| 188 | $self->{_overrides_assert_return} = | ||||
| 189 | ( $self->can( 'assert_return' ) != \&assert_return ) | ||||
| 190 | 64 | 261µs | 61 | 418µs | unless exists $self->{_overrides_assert_return}; # spent 418µs making 61 calls to Type::Tiny::can, avg 7µs/call |
| 191 | |||||
| 192 | 64 | 109µs | if ( $self->{_overrides_assert_return} ) { | ||
| 193 | $self->{_overload_coderef} ||= do { | ||||
| 194 | Scalar::Util::weaken( my $weak = $self ); | ||||
| 195 | sub { $weak->assert_return( @_ ) }; | ||||
| 196 | }; | ||||
| 197 | ++$self->{_overload_coderef_no_rebuild}; | ||||
| 198 | } | ||||
| 199 | elsif ( exists( &Sub::Quote::quote_sub ) ) { | ||||
| 200 | |||||
| 201 | # Use `=` instead of `||=` because we want to overwrite non-Sub::Quote | ||||
| 202 | # coderef if possible. | ||||
| 203 | 27 | 210µs | 81 | 23.7ms | $self->{_overload_coderef} = $self->can_be_inlined # spent 21.7ms making 27 calls to Type::Tiny::inline_assert, avg 805µs/call
# spent 1.56ms making 27 calls to Sub::Quote::quote_sub, avg 58µs/call
# spent 386µs making 23 calls to Type::Tiny::can_be_inlined, avg 17µs/call
# spent 32µs making 1 call to Type::Tiny::Union::can_be_inlined
# spent 2µs making 3 calls to Type::Tiny::Enum::can_be_inlined, avg 667ns/call |
| 204 | ? Sub::Quote::quote_sub( | ||||
| 205 | $self->inline_assert( '$_[0]' ), | ||||
| 206 | ) | ||||
| 207 | : Sub::Quote::quote_sub( | ||||
| 208 | $self->inline_assert( '$_[0]', '$type' ), | ||||
| 209 | { '$type' => \$self }, | ||||
| 210 | ); | ||||
| 211 | 27 | 26µs | ++$self->{_overload_coderef_no_rebuild}; | ||
| 212 | } #/ elsif ( exists( &Sub::Quote::quote_sub...)) | ||||
| 213 | else { | ||||
| 214 | 37 | 23µs | require Eval::TypeTiny; | ||
| 215 | 37 | 292µs | 148 | 15.7ms | $self->{_overload_coderef} ||= $self->can_be_inlined # spent 7.34ms making 37 calls to Eval::TypeTiny::eval_closure, avg 198µs/call
# spent 7.24ms making 37 calls to Type::Tiny::inline_assert, avg 196µs/call
# spent 858µs making 37 calls to Type::Tiny::can_be_inlined, avg 23µs/call
# spent 264µs making 37 calls to Type::Tiny::__ANON__[Type/Tiny.pm:100], avg 7µs/call |
| 216 | ? Eval::TypeTiny::eval_closure( | ||||
| 217 | source => sprintf( | ||||
| 218 | 'sub { %s }', $self->inline_assert( '$_[0]', undef, no_wrapper => 1 ) | ||||
| 219 | ), | ||||
| 220 | description => sprintf( "compiled assertion 'assert_%s'", $self ), | ||||
| 221 | ) | ||||
| 222 | : Eval::TypeTiny::eval_closure( | ||||
| 223 | source => sprintf( | ||||
| 224 | 'sub { %s }', $self->inline_assert( '$_[0]', '$type', no_wrapper => 1 ) | ||||
| 225 | ), | ||||
| 226 | description => sprintf( "compiled assertion 'assert_%s'", $self ), | ||||
| 227 | environment => { '$type' => \$self }, | ||||
| 228 | ); | ||||
| 229 | } #/ else [ if ( $self->{_overrides_assert_return...})] | ||||
| 230 | |||||
| 231 | 64 | 287µs | $self->{_overload_coderef}; | ||
| 232 | } #/ sub _overload_coderef | ||||
| 233 | |||||
| 234 | our %ALL_TYPES; | ||||
| 235 | |||||
| 236 | 1 | 0s | my $QFS; | ||
| 237 | 1 | 1µs | my $uniq = 1; | ||
| 238 | |||||
| 239 | # spent 6.31ms (3.43+2.88) within Type::Tiny::new which was called 82 times, avg 77µs/call:
# 37 times (1.59ms+1.18ms) by Type::Library::add_type at line 222 of Type/Library.pm, avg 75µs/call
# 27 times (1.20ms+1.46ms) by Type::Tiny::create_child_type at line 1096, avg 98µs/call
# 11 times (391µs+152µs) by Type::Tiny::ConstrainedObject::new at line 36 of Type/Tiny/ConstrainedObject.pm, avg 49µs/call
# 4 times (172µs+50µs) by Type::Tiny::Enum::new at line 84 of Type/Tiny/Enum.pm, avg 56µs/call
# once (42µs+11µs) by Type::Tiny::Union::new at line 85 of Type/Tiny/Union.pm
# once (28µs+17µs) by Types::TypeTiny::TypeTiny at line 421 of Types/TypeTiny.pm
# once (17µs+12µs) by Types::TypeTiny::StringLike at line 195 of Types/TypeTiny.pm | ||||
| 240 | 82 | 25µs | my $class = shift; | ||
| 241 | 82 | 241µs | my %params = ( @_ == 1 ) ? %{ $_[0] } : @_; | ||
| 242 | |||||
| 243 | 82 | 97µs | for ( qw/ name display_name library / ) { | ||
| 244 | 246 | 196µs | $params{$_} = $params{$_} . '' if defined $params{$_}; | ||
| 245 | } | ||||
| 246 | |||||
| 247 | 82 | 67µs | if ( exists $params{parent} ) { | ||
| 248 | $params{parent} = | ||||
| 249 | ref( $params{parent} ) =~ /^Type::Tiny\b/ | ||||
| 250 | ? $params{parent} | ||||
| 251 | 63 | 368µs | 63 | 138µs | : Types::TypeTiny::to_TypeTiny( $params{parent} ); # spent 138µs making 63 calls to Type::Tiny::CORE:match, avg 2µs/call |
| 252 | |||||
| 253 | _croak "Parent must be an instance of %s", __PACKAGE__ | ||||
| 254 | unless blessed( $params{parent} ) | ||||
| 255 | 63 | 290µs | 126 | 418µs | && $params{parent}->isa( __PACKAGE__ ); # spent 360µs making 63 calls to Type::Tiny::isa, avg 6µs/call
# spent 58µs making 63 calls to Scalar::Util::blessed, avg 921ns/call |
| 256 | |||||
| 257 | 63 | 126µs | 63 | 140µs | if ( $params{parent}->deprecated and not exists $params{deprecated} ) { # spent 140µs making 63 calls to Type::Tiny::deprecated, avg 2µs/call |
| 258 | $params{deprecated} = 1; | ||||
| 259 | } | ||||
| 260 | } #/ if ( exists $params{parent...}) | ||||
| 261 | |||||
| 262 | 82 | 48µs | if ( exists $params{constraint} | ||
| 263 | and defined $params{constraint} | ||||
| 264 | and not ref $params{constraint} ) | ||||
| 265 | { | ||||
| 266 | 5 | 6µs | require Eval::TypeTiny; | ||
| 267 | 5 | 4µs | my $code = $params{constraint}; | ||
| 268 | 5 | 27µs | 5 | 690µs | $params{constraint} = Eval::TypeTiny::eval_closure( # spent 690µs making 5 calls to Eval::TypeTiny::eval_closure, avg 138µs/call |
| 269 | source => sprintf( 'sub ($) { %s }', $code ), | ||||
| 270 | description => "anonymous check", | ||||
| 271 | ); | ||||
| 272 | # spent 237µs (219+18) within Type::Tiny::__ANON__[/Users/ether/.perlbrew/libs/36.0@std/lib/perl5/Type/Tiny.pm:276] which was called 30 times, avg 8µs/call:
# 30 times (219µs+18µs) by Type::Tiny::inline_check at line 895, avg 8µs/call | ||||
| 273 | 30 | 16µs | my ( $type ) = @_; | ||
| 274 | 30 | 61µs | my $inlined = $_ eq '$_' ? "do { $code }" : "do { local \$_ = $_; $code }"; | ||
| 275 | 30 | 125µs | 30 | 18µs | $type->has_parent ? ( undef, $inlined ) : $inlined; # spent 18µs making 30 calls to Type::Tiny::has_parent, avg 600ns/call |
| 276 | } | ||||
| 277 | 5 | 58µs | 5 | 140µs | if ( !exists $params{parent} or $params{parent}->can_be_inlined ); # spent 140µs making 5 calls to Type::Tiny::can_be_inlined, avg 28µs/call |
| 278 | } #/ if ( exists $params{constraint...}) | ||||
| 279 | |||||
| 280 | # canonicalize to a boolean | ||||
| 281 | 82 | 98µs | $params{deprecated} = !!$params{deprecated}; | ||
| 282 | |||||
| 283 | 82 | 48µs | $params{name} = "__ANON__" unless exists $params{name}; | ||
| 284 | 82 | 65µs | $params{uniq} = $uniq++; | ||
| 285 | |||||
| 286 | 82 | 53µs | if ( $params{name} ne "__ANON__" ) { | ||
| 287 | |||||
| 288 | # First try a fast ASCII-only expression, but fall back to Unicode | ||||
| 289 | $params{name} =~ /^_{0,2}[A-Z][A-Za-z0-9_]+$/sm | ||||
| 290 | or eval q( use 5.008; $params{name} =~ /^_{0,2}\p{Lu}[\p{L}0-9_]+$/sm ) | ||||
| 291 | 39 | 259µs | 39 | 156µs | or _croak '"%s" is not a valid type name', $params{name}; # spent 156µs making 39 calls to Type::Tiny::CORE:match, avg 4µs/call |
| 292 | } | ||||
| 293 | |||||
| 294 | 82 | 22µs | if ( exists $params{coercion} and !ref $params{coercion} and $params{coercion} ) | ||
| 295 | { | ||||
| 296 | $params{parent}->has_coercion | ||||
| 297 | or _croak | ||||
| 298 | "coercion => 1 requires type to have a direct parent with a coercion"; | ||||
| 299 | |||||
| 300 | $params{coercion} = $params{parent}->coercion->type_coercion_map; | ||||
| 301 | } | ||||
| 302 | |||||
| 303 | 82 | 41µs | if ( !exists $params{inlined} | ||
| 304 | and exists $params{constraint} | ||||
| 305 | and ( !exists $params{parent} or $params{parent}->can_be_inlined ) | ||||
| 306 | and $QFS ||= "Sub::Quote"->can( "quoted_from_sub" ) ) | ||||
| 307 | { | ||||
| 308 | my ( undef, $perlstring, $captures ) = @{ $QFS->( $params{constraint} ) || [] }; | ||||
| 309 | |||||
| 310 | $params{inlined} = sub { | ||||
| 311 | my ( $self, $var ) = @_; | ||||
| 312 | my $code = Sub::Quote::inlinify( | ||||
| 313 | $perlstring, | ||||
| 314 | $var, | ||||
| 315 | $var eq q($_) ? '' : "local \$_ = $var;", | ||||
| 316 | 1, | ||||
| 317 | ); | ||||
| 318 | $code = sprintf( '%s and %s', $self->parent->inline_check( $var ), $code ) | ||||
| 319 | if $self->has_parent; | ||||
| 320 | return $code; | ||||
| 321 | } | ||||
| 322 | if $perlstring && !$captures; | ||||
| 323 | } #/ if ( !exists $params{inlined...}) | ||||
| 324 | |||||
| 325 | 82 | 95µs | my $self = bless \%params, $class; | ||
| 326 | |||||
| 327 | 82 | 72µs | unless ( $params{tmp} ) { | ||
| 328 | 82 | 220µs | my $uniq = $self->{uniq}; | ||
| 329 | |||||
| 330 | 82 | 107µs | $ALL_TYPES{$uniq} = $self; | ||
| 331 | 82 | 302µs | 82 | 79µs | Scalar::Util::weaken( $ALL_TYPES{$uniq} ); # spent 79µs making 82 calls to Scalar::Util::weaken, avg 963ns/call |
| 332 | |||||
| 333 | 82 | 22µs | my $tmp = $self; | ||
| 334 | 82 | 176µs | 82 | 48µs | Scalar::Util::weaken( $tmp ); # spent 48µs making 82 calls to Scalar::Util::weaken, avg 585ns/call |
| 335 | 82 | 382µs | 82 | 1.03ms | $Moo::HandleMoose::TYPE_MAP{ $self->_stringify_no_magic } = sub { $tmp }; # spent 1.03ms making 82 calls to Type::Tiny::_stringify_no_magic, avg 13µs/call |
| 336 | } #/ unless ( $params{tmp} ) | ||||
| 337 | |||||
| 338 | 82 | 113µs | if ( ref( $params{coercion} ) eq q(CODE) ) { | ||
| 339 | require Types::Standard; | ||||
| 340 | my $code = delete( $params{coercion} ); | ||||
| 341 | $self->{coercion} = $self->_build_coercion; | ||||
| 342 | $self->coercion->add_type_coercions( Types::Standard::Any(), $code ); | ||||
| 343 | } | ||||
| 344 | elsif ( ref( $params{coercion} ) eq q(ARRAY) ) { | ||||
| 345 | my $arr = delete( $params{coercion} ); | ||||
| 346 | $self->{coercion} = $self->_build_coercion; | ||||
| 347 | $self->coercion->add_type_coercions( @$arr ); | ||||
| 348 | } | ||||
| 349 | |||||
| 350 | # Documenting this here because it's too weird to be in the pod. | ||||
| 351 | # There's a secret attribute called "_build_coercion" which takes a | ||||
| 352 | # coderef. If present, then when $type->coercion is lazy built, | ||||
| 353 | # the blank Type::Coercion object gets passed to the coderef, | ||||
| 354 | # allowing the coderef to manipulate it a little. This is used by | ||||
| 355 | # Types::TypeTiny to allow it to build a coercion for the TypeTiny | ||||
| 356 | # type constraint without needing to load Type::Coercion yet. | ||||
| 357 | |||||
| 358 | 82 | 26µs | if ( $params{my_methods} ) { | ||
| 359 | 4 | 3µs | require Eval::TypeTiny; | ||
| 360 | Scalar::Util::reftype( $params{my_methods}{$_} ) eq 'CODE' | ||||
| 361 | and Eval::TypeTiny::set_subname( | ||||
| 362 | sprintf( "%s::my_%s", $self->qualified_name, $_ ), | ||||
| 363 | $params{my_methods}{$_}, | ||||
| 364 | 4 | 31µs | 13 | 36µs | ) for keys %{ $params{my_methods} }; # spent 25µs making 2 calls to Eval::TypeTiny::set_subname, avg 12µs/call
# spent 7µs making 2 calls to Type::Tiny::qualified_name, avg 4µs/call
# spent 4µs making 9 calls to Scalar::Util::reftype, avg 444ns/call |
| 365 | } #/ if ( $params{my_methods...}) | ||||
| 366 | |||||
| 367 | 82 | 170µs | return $self; | ||
| 368 | } #/ sub new | ||||
| 369 | |||||
| 370 | # spent 27µs (20+7) within Type::Tiny::DESTROY which was called:
# once (20µs+7µs) by JSON::Schema::Modern::add_vocabulary at line 708 of JSON/Schema/Modern.pm | ||||
| 371 | 1 | 1µs | my $self = shift; | ||
| 372 | 1 | 14µs | delete( $ALL_TYPES{ $self->{uniq} } ); | ||
| 373 | 1 | 3µs | 1 | 7µs | delete( $Moo::HandleMoose::TYPE_MAP{ $self->_stringify_no_magic } ); # spent 7µs making 1 call to Type::Tiny::_stringify_no_magic |
| 374 | 1 | 2µs | return; | ||
| 375 | } | ||||
| 376 | |||||
| 377 | sub _clone { | ||||
| 378 | my $self = shift; | ||||
| 379 | my %opts; | ||||
| 380 | $opts{$_} = $self->{$_} for qw< name display_name message >; | ||||
| 381 | $self->create_child_type( %opts ); | ||||
| 382 | } | ||||
| 383 | |||||
| 384 | sub _stringify_no_magic { | ||||
| 385 | 83 | 1.08ms | 249 | 150µs | sprintf( # spent 66µs making 83 calls to Scalar::Util::blessed, avg 795ns/call
# spent 56µs making 83 calls to Scalar::Util::reftype, avg 675ns/call
# spent 28µs making 83 calls to Scalar::Util::refaddr, avg 337ns/call |
| 386 | '%s=%s(0x%08x)', blessed( $_[0] ), Scalar::Util::reftype( $_[0] ), | ||||
| 387 | Scalar::Util::refaddr( $_[0] ) | ||||
| 388 | ); | ||||
| 389 | } | ||||
| 390 | |||||
| 391 | our $DD; | ||||
| 392 | |||||
| 393 | sub _dd { | ||||
| 394 | @_ = $_ unless @_; | ||||
| 395 | my ( $value ) = @_; | ||||
| 396 | |||||
| 397 | goto $DD if ref( $DD ) eq q(CODE); | ||||
| 398 | |||||
| 399 | require B; | ||||
| 400 | |||||
| 401 | !defined $value ? 'Undef' | ||||
| 402 | : !ref $value ? sprintf( 'Value %s', B::perlstring( $value ) ) | ||||
| 403 | : do { | ||||
| 404 | my $N = 0+ ( defined( $DD ) ? $DD : 72 ); | ||||
| 405 | require Data::Dumper; | ||||
| 406 | local $Data::Dumper::Indent = 0; | ||||
| 407 | local $Data::Dumper::Useqq = 1; | ||||
| 408 | local $Data::Dumper::Terse = 1; | ||||
| 409 | local $Data::Dumper::Sortkeys = 1; | ||||
| 410 | local $Data::Dumper::Maxdepth = 2; | ||||
| 411 | my $str; | ||||
| 412 | eval { | ||||
| 413 | $str = Data::Dumper::Dumper( $value ); | ||||
| 414 | $str = substr( $str, 0, $N - 12 ) . '...' . substr( $str, -1, 1 ) | ||||
| 415 | if length( $str ) >= $N; | ||||
| 416 | 1; | ||||
| 417 | } or do { $str = 'which cannot be dumped' }; | ||||
| 418 | "Reference $str"; | ||||
| 419 | } #/ do | ||||
| 420 | } #/ sub _dd | ||||
| 421 | |||||
| 422 | # spent 14.0ms (5.96+8.06) within Type::Tiny::_loose_to_TypeTiny which was called 1691 times, avg 8µs/call:
# 794 times (2.88ms+3.83ms) by Type::Tiny::strictly_equals at line 686, avg 8µs/call
# 703 times (2.20ms+3.20ms) by Type::Tiny::is_strictly_subtype_of at line 693, avg 8µs/call
# 191 times (873µs+1.02ms) by Type::Tiny::is_strictly_a_type_of at line 711, avg 10µs/call
# 3 times (11µs+16µs) by Type::Tiny::__ANON__[/Users/ether/.perlbrew/libs/36.0@std/lib/perl5/Type/Tiny.pm:602] at line 589, avg 9µs/call | ||||
| 423 | 1691 | 432µs | my $caller = caller( 1 ); # assumption | ||
| 424 | map +( | ||||
| 425 | ref( $_ ) | ||||
| 426 | ? Types::TypeTiny::to_TypeTiny( $_ ) | ||||
| 427 | 1691 | 4.60ms | 3382 | 8.06ms | : do { require Type::Utils; Type::Utils::dwim_type( $_, for => $caller ) } # spent 8.06ms making 3382 calls to Types::TypeTiny::to_TypeTiny, avg 2µs/call |
| 428 | ), @_; | ||||
| 429 | } | ||||
| 430 | |||||
| 431 | 297 | 641µs | # spent 308µs within Type::Tiny::name which was called 297 times, avg 1µs/call:
# 129 times (126µs+0s) by Type::Tiny::is_anon at line 727, avg 977ns/call
# 46 times (47µs+0s) by Type::Tiny::qualified_name at line 722, avg 1µs/call
# 44 times (60µs+0s) by Type::Tiny::_build_display_name at line 487, avg 1µs/call
# 40 times (53µs+0s) by Type::Library::_exporter_expand_sub at line 72 of Type/Library.pm, avg 1µs/call
# 38 times (22µs+0s) by Type::Tiny::exportables at line 1187, avg 579ns/call | ||
| 432 | 372 | 837µs | 45 | 207µs | # spent 730µs (524+206) within Type::Tiny::display_name which was called 372 times, avg 2µs/call:
# 372 times (524µs+206µs) by Type::Tiny::__ANON__[/Users/ether/.perlbrew/libs/36.0@std/lib/perl5/Type/Tiny.pm:100] at line 97, avg 2µs/call # spent 191µs making 44 calls to Type::Tiny::_build_display_name, avg 4µs/call
# spent 16µs making 1 call to Type::Tiny::Union::_build_display_name |
| 433 | 1139 | 1.64ms | # spent 680µs within Type::Tiny::parent which was called 1139 times, avg 597ns/call:
# 981 times (575µs+0s) by Type::Tiny::is_strictly_subtype_of at line 698, avg 586ns/call
# 60 times (24µs+0s) by Type::Tiny::can_be_inlined at line 877, avg 400ns/call
# 32 times (37µs+0s) by Type::Tiny::inline_check at line 899, avg 1µs/call
# 20 times (12µs+0s) by Type::Tiny::inline_check at line 889, avg 600ns/call
# 14 times (11µs+0s) by Type::Tiny::_build_compiled_check at line 532, avg 786ns/call
# 12 times (5µs+0s) by Type::Tiny::__ANON__[/Users/ether/.perlbrew/libs/36.0@std/lib/perl5/Type/Tiny.pm:659] at line 629, avg 417ns/call
# 6 times (7µs+0s) by Type::Tiny::_lookup_my_method at line 1369, avg 1µs/call
# 6 times (3µs+0s) by Types::Standard::Dict::__inline_generator at line 103 of Types/Standard/Dict.pm, avg 500ns/call
# 3 times (1µs+0s) by Type::Tiny::__ANON__[/Users/ether/.perlbrew/libs/36.0@std/lib/perl5/Type/Tiny.pm:659] at line 645, avg 333ns/call
# 2 times (4µs+0s) by Types::Standard::__ANON__[/Users/ether/.perlbrew/libs/36.0@std/lib/perl5/Types/Standard.pm:945] at line 940 of Types/Standard.pm, avg 2µs/call
# 2 times (0s+0s) by Types::Standard::__ANON__[/Users/ether/.perlbrew/libs/36.0@std/lib/perl5/Types/Standard.pm:750] at line 750 of Types/Standard.pm, avg 0s/call
# once (1µs+0s) by Type::Tiny::type_default at line 573 | ||
| 434 | 1551 | 2.31ms | 15 | 17µs | # spent 1.05ms (1.04+17µs) within Type::Tiny::constraint which was called 1551 times, avg 680ns/call:
# 1551 times (1.04ms+17µs) by Type::Tiny::_is_null_constraint at line 495, avg 680ns/call # spent 17µs making 15 calls to Type::Tiny::_build_constraint, avg 1µs/call |
| 435 | |||||
| 436 | # spent 22.3ms (423µs+21.9) within Type::Tiny::compiled_check which was called 169 times, avg 132µs/call:
# 58 times (131µs+7.28ms) by Type::Coercion::_preserve_type_constraint at line 111 of Type/Coercion.pm, avg 128µs/call
# 37 times (175µs+5.18ms) by Type::Tiny::exportables at line 1203, avg 145µs/call
# 24 times (15µs+0s) by Type::Tiny::__ANON__[/Users/ether/.perlbrew/libs/36.0@std/lib/perl5/Type/Tiny.pm:659] at line 632, avg 625ns/call
# 14 times (24µs+-24µs) by Type::Tiny::_build_compiled_check at line 532, avg 0s/call
# 8 times (48µs+8.54ms) by Types::Standard::HashRef::__constraint_generator at line 32 of Types/Standard/HashRef.pm, avg 1.07ms/call
# 8 times (7µs+0s) by Types::Standard::HashRef::__inline_generator at line 58 of Types/Standard/HashRef.pm, avg 875ns/call
# 6 times (5µs+0s) by Type::Tiny::__ANON__[/Users/ether/.perlbrew/libs/36.0@std/lib/perl5/Type/Tiny.pm:659] at line 609, avg 833ns/call
# 6 times (1µs+0s) by Type::Tiny::__ANON__[/Users/ether/.perlbrew/libs/36.0@std/lib/perl5/Type/Tiny.pm:659] at line 617, avg 167ns/call
# 4 times (16µs+947µs) by Types::Standard::ArrayRef::__constraint_generator at line 36 of Types/Standard/ArrayRef.pm, avg 241µs/call
# 4 times (1µs+0s) by Types::Standard::ArrayRef::__inline_generator at line 93 of Types/Standard/ArrayRef.pm, avg 250ns/call | ||||
| 437 | 169 | 575µs | 60 | 21.9ms | $_[0]{compiled_type_constraint} ||= $_[0]->_build_compiled_check; # spent 19.9ms making 56 calls to Type::Tiny::_build_compiled_check, avg 355µs/call
# spent 2.04ms making 4 calls to Type::Tiny::Enum::_build_compiled_check, avg 511µs/call |
| 438 | } | ||||
| 439 | 58 | 211µs | 58 | 13.9ms | # spent 14.0ms (198µs+13.8) within Type::Tiny::coercion which was called 58 times, avg 242µs/call:
# 37 times (96µs+1.79ms) by Type::Library::make_immutable at line 318 of Type/Library.pm, avg 51µs/call
# 14 times (76µs+9.05ms) by Type::Tiny::parameterize at line 1082, avg 652µs/call
# 3 times (16µs+-16µs) by Type::Tiny::has_coercion at line 471, avg 0s/call
# 2 times (4µs+2µs) by Type::Tiny::exportables at line 1220, avg 3µs/call
# once (3µs+3.02ms) by JSON::Schema::Modern::BEGIN@31 at line 234 of Types/Standard.pm
# once (3µs+0s) by Type::Library::make_immutable at line 319 of Type/Library.pm # spent 16.9ms making 54 calls to Type::Tiny::_build_coercion, avg 313µs/call, recursion: max depth 2, sum of overlapping time 3.06ms
# spent 2µs making 4 calls to Type::Coercion::__ANON__[Type/Coercion.pm:28], avg 500ns/call |
| 440 | sub message { $_[0]{message} } | ||||
| 441 | sub library { $_[0]{library} } | ||||
| 442 | 529 | 818µs | # spent 388µs within Type::Tiny::inlined which was called 529 times, avg 733ns/call:
# 529 times (388µs+0s) by Type::Tiny::inline_check at line 895, avg 733ns/call | ||
| 443 | 103 | 273µs | # spent 185µs within Type::Tiny::deprecated which was called 103 times, avg 2µs/call:
# 63 times (140µs+0s) by Type::Tiny::new at line 257, avg 2µs/call
# 40 times (45µs+0s) by Type::Library::_exporter_install_sub at line 133 of Type/Library.pm, avg 1µs/call | ||
| 444 | 34 | 70µs | # spent 53µs within Type::Tiny::constraint_generator which was called 34 times, avg 2µs/call:
# 34 times (53µs+0s) by Type::Tiny::parameterize at line 1044, avg 2µs/call | ||
| 445 | 20 | 56µs | # spent 46µs within Type::Tiny::inline_generator which was called 20 times, avg 2µs/call:
# 20 times (46µs+0s) by Type::Tiny::parameterize at line 1057, avg 2µs/call | ||
| 446 | 22 | 68µs | 5 | 18µs | # spent 68µs (50+18) within Type::Tiny::name_generator which was called 22 times, avg 3µs/call:
# 20 times (44µs+15µs) by Type::Tiny::parameterize at line 1050, avg 3µs/call
# 2 times (6µs+3µs) by Types::Standard::__ANON__[/Users/ether/.perlbrew/libs/36.0@std/lib/perl5/Types/Standard.pm:737] at line 735 of Types/Standard.pm, avg 4µs/call # spent 18µs making 5 calls to Type::Tiny::_build_name_generator, avg 4µs/call |
| 447 | 3 | 132µs | # spent 5µs within Type::Tiny::coercion_generator which was called 3 times, avg 2µs/call:
# 3 times (5µs+0s) by Type::Tiny::__ANON__[/Users/ether/.perlbrew/libs/36.0@std/lib/perl5/Type/Tiny.pm:1073] at line 1070, avg 2µs/call | ||
| 448 | 5 | 21µs | # spent 18µs within Type::Tiny::parameters which was called 5 times, avg 4µs/call:
# 3 times (4µs+0s) by Types::Standard::Dict::__inline_generator at line 103 of Types/Standard/Dict.pm, avg 1µs/call
# 2 times (14µs+0s) by Type::Tiny::type_parameter at line 1581, avg 7µs/call | ||
| 449 | sub moose_type { $_[0]{moose_type} ||= $_[0]->_build_moose_type } | ||||
| 450 | sub mouse_type { $_[0]{mouse_type} ||= $_[0]->_build_mouse_type } | ||||
| 451 | sub deep_explanation { $_[0]{deep_explanation} } | ||||
| 452 | 18 | 37µs | 2 | 2µs | # spent 28µs (26+2) within Type::Tiny::my_methods which was called 18 times, avg 2µs/call:
# 18 times (26µs+2µs) by Type::Tiny::_lookup_my_method at line 1365, avg 2µs/call # spent 2µs making 2 calls to Type::Tiny::_build_my_methods, avg 1µs/call |
| 453 | sub sorter { $_[0]{sorter} } | ||||
| 454 | |||||
| 455 | 3648 | 5.58ms | # spent 2.23ms within Type::Tiny::has_parent which was called 3648 times, avg 613ns/call:
# 919 times (703µs+0s) by Type::Tiny::can_be_inlined at line 877, avg 765ns/call
# 859 times (461µs+0s) by Type::Tiny::can_be_inlined at line 879, avg 537ns/call
# 639 times (422µs+0s) by Type::Tiny::is_strictly_subtype_of at line 697, avg 660ns/call
# 575 times (289µs+0s) by Type::Tiny::inline_check at line 889, avg 503ns/call
# 555 times (295µs+0s) by Type::Tiny::inline_check at line 891, avg 532ns/call
# 32 times (15µs+0s) by Type::Tiny::inline_check at line 897, avg 469ns/call
# 30 times (18µs+0s) by Type::Tiny::__ANON__[/Users/ether/.perlbrew/libs/36.0@std/lib/perl5/Type/Tiny.pm:276] at line 275, avg 600ns/call
# 15 times (21µs+0s) by Type::Tiny::_build_compiled_check at line 532, avg 1µs/call
# 12 times (6µs+0s) by Type::Tiny::__ANON__[/Users/ether/.perlbrew/libs/36.0@std/lib/perl5/Type/Tiny.pm:659] at line 635, avg 500ns/call
# 6 times (1µs+0s) by Type::Tiny::_lookup_my_method at line 1369, avg 167ns/call
# 3 times (3µs+0s) by Type::Tiny::__ANON__[/Users/ether/.perlbrew/libs/36.0@std/lib/perl5/Type/Tiny.pm:659] at line 628, avg 1µs/call
# 3 times (1µs+0s) by Type::Tiny::__ANON__[/Users/ether/.perlbrew/libs/36.0@std/lib/perl5/Type/Tiny.pm:659] at line 644, avg 333ns/call | ||
| 456 | sub has_library { exists $_[0]{library} } | ||||
| 457 | 804 | 1.32ms | # spent 541µs within Type::Tiny::has_inlined which was called 804 times, avg 673ns/call:
# 804 times (541µs+0s) by Type::Tiny::can_be_inlined at line 881, avg 673ns/call | ||
| 458 | 106 | 303µs | # spent 192µs within Type::Tiny::has_constraint_generator which was called 106 times, avg 2µs/call:
# 106 times (192µs+0s) by Type::Tiny::is_parameterizable at line 998, avg 2µs/call | ||
| 459 | 20 | 42µs | # spent 22µs within Type::Tiny::has_inline_generator which was called 20 times, avg 1µs/call:
# 20 times (22µs+0s) by Type::Tiny::parameterize at line 1057, avg 1µs/call | ||
| 460 | 54 | 153µs | sub has_coercion_generator { exists $_[0]{coercion_generator} } | ||
| 461 | 3 | 5µs | # spent 4µs within Type::Tiny::has_parameters which was called 3 times, avg 1µs/call:
# 3 times (4µs+0s) by Type::Tiny::is_parameterized at line 1002, avg 1µs/call | ||
| 462 | sub has_message { defined $_[0]{message} } | ||||
| 463 | sub has_deep_explanation { exists $_[0]{deep_explanation} } | ||||
| 464 | sub has_sorter { exists $_[0]{sorter} } | ||||
| 465 | |||||
| 466 | sub _default_message { | ||||
| 467 | $_[0]{_default_message} ||= $_[0]->_build_default_message; | ||||
| 468 | } | ||||
| 469 | |||||
| 470 | # spent 2.83ms (373µs+2.46) within Type::Tiny::has_coercion which was called 85 times, avg 33µs/call:
# 38 times (71µs+3µs) by Type::Tiny::exportables at line 1220, avg 2µs/call
# 37 times (238µs+86µs) by Type::Library::make_immutable at line 319 of Type/Library.pm, avg 9µs/call
# 2 times (19µs+2.40ms) by Types::Standard::__ANON__[/Users/ether/.perlbrew/libs/36.0@std/lib/perl5/Types/Standard.pm:732] at line 729 of Types/Standard.pm, avg 1.21ms/call
# 2 times (9µs+4µs) by Type::Tiny::Union::new at line 86 of Type/Tiny/Union.pm, avg 6µs/call
# 2 times (14µs+-14µs) by Types::Standard::Dict::__coercion_generator at line 257 of Types/Standard/Dict.pm, avg 0s/call
# 2 times (6µs+-6µs) by Types::Standard::Dict::__coercion_generator at line 258 of Types/Standard/Dict.pm, avg 0s/call
# 2 times (16µs+-16µs) by Types::Standard::HashRef::__coercion_generator at line 103 of Types/Standard/HashRef.pm, avg 0s/call | ||||
| 471 | 85 | 34µs | 3 | 0s | $_[0]->coercion if $_[0]{_build_coercion}; # trigger auto build thing # spent 3.08ms making 3 calls to Type::Tiny::coercion, avg 1.03ms/call, recursion: max depth 2, sum of overlapping time 3.08ms |
| 472 | 85 | 302µs | 96 | 106µs | $_[0]{coercion} and !!@{ $_[0]{coercion}->type_coercion_map }; # spent 77µs making 48 calls to Type::Coercion::type_coercion_map, avg 2µs/call
# spent 29µs making 48 calls to Type::Coercion::__ANON__[Type/Coercion.pm:28], avg 604ns/call |
| 473 | } | ||||
| 474 | |||||
| 475 | sub _assert_coercion { | ||||
| 476 | my $self = shift; | ||||
| 477 | return $self->coercion if $self->{_build_coercion}; # trigger auto build thing | ||||
| 478 | _croak "No coercion for this type constraint" | ||||
| 479 | unless $self->has_coercion | ||||
| 480 | && @{ $self->coercion->type_coercion_map }; | ||||
| 481 | $self->coercion; | ||||
| 482 | } | ||||
| 483 | |||||
| 484 | 1 | 1µs | my $null_constraint = sub { !!1 }; | ||
| 485 | |||||
| 486 | # spent 191µs (131+60) within Type::Tiny::_build_display_name which was called 44 times, avg 4µs/call:
# 44 times (131µs+60µs) by Type::Tiny::display_name at line 432, avg 4µs/call | ||||
| 487 | 44 | 131µs | 44 | 60µs | shift->name; # spent 60µs making 44 calls to Type::Tiny::name, avg 1µs/call |
| 488 | } | ||||
| 489 | |||||
| 490 | # spent 17µs within Type::Tiny::_build_constraint which was called 15 times, avg 1µs/call:
# 15 times (17µs+0s) by Type::Tiny::constraint at line 434, avg 1µs/call | ||||
| 491 | 15 | 44µs | return $null_constraint; | ||
| 492 | } | ||||
| 493 | |||||
| 494 | # spent 4.38ms (3.33+1.06) within Type::Tiny::_is_null_constraint which was called 1551 times, avg 3µs/call:
# 860 times (1.87ms+552µs) by Type::Tiny::can_be_inlined at line 877, avg 3µs/call
# 547 times (1.11ms+266µs) by Type::Tiny::inline_check at line 889, avg 3µs/call
# 59 times (107µs+35µs) by Type::Tiny::can_be_inlined at line 879, avg 2µs/call
# 50 times (152µs+184µs) by Type::Tiny::_build_compiled_check at line 532, avg 7µs/call
# 28 times (75µs+11µs) by Type::Tiny::inline_check at line 891, avg 3µs/call
# 6 times (10µs+5µs) by Type::Tiny::find_constraining_type at line 558, avg 2µs/call
# once (5µs+2µs) by Type::Tiny::type_default at line 573 | ||||
| 495 | 1551 | 3.40ms | 1551 | 1.05ms | shift->constraint == $null_constraint; # spent 1.05ms making 1551 calls to Type::Tiny::constraint, avg 680ns/call |
| 496 | } | ||||
| 497 | |||||
| 498 | # spent 13.9ms (3.47+10.4) within Type::Tiny::_build_coercion which was called 54 times, avg 256µs/call:
# 54 times (3.47ms+10.4ms) by Type::Tiny::coercion at line 439, avg 256µs/call | ||||
| 499 | 54 | 494µs | require Type::Coercion; | ||
| 500 | 54 | 14µs | my $self = shift; | ||
| 501 | 54 | 42µs | my %opts = ( type_constraint => $self ); | ||
| 502 | 54 | 228µs | 91 | 505µs | $opts{display_name} = "to_$self" unless $self->is_anon; # spent 253µs making 37 calls to Type::Tiny::__ANON__[Type/Tiny.pm:100], avg 7µs/call
# spent 252µs making 54 calls to Type::Tiny::is_anon, avg 5µs/call |
| 503 | 54 | 123µs | 54 | 9.00ms | my $coercion = "Type::Coercion"->new( %opts ); # spent 9.00ms making 54 calls to Type::Coercion::new, avg 167µs/call |
| 504 | 54 | 41µs | 5 | 3.80ms | $self->{_build_coercion}->( $coercion ) if ref $self->{_build_coercion}; # spent 2.44ms making 2 calls to Types::Standard::__ANON__[Types/Standard.pm:732], avg 1.22ms/call
# spent 1.36ms making 3 calls to Type::Tiny::__ANON__[Type/Tiny.pm:1073], avg 454µs/call |
| 505 | 54 | 124µs | $coercion; | ||
| 506 | } | ||||
| 507 | |||||
| 508 | sub _build_default_message { | ||||
| 509 | my $self = shift; | ||||
| 510 | $self->{is_using_default_message} = 1; | ||||
| 511 | return sub { sprintf '%s did not pass type constraint', _dd( $_[0] ) } | ||||
| 512 | if "$self" eq "__ANON__"; | ||||
| 513 | my $name = "$self"; | ||||
| 514 | return sub { | ||||
| 515 | sprintf '%s did not pass type constraint "%s"', _dd( $_[0] ), $name; | ||||
| 516 | }; | ||||
| 517 | } #/ sub _build_default_message | ||||
| 518 | |||||
| 519 | # spent 18µs within Type::Tiny::_build_name_generator which was called 5 times, avg 4µs/call:
# 5 times (18µs+0s) by Type::Tiny::name_generator at line 446, avg 4µs/call | ||||
| 520 | 5 | 1µs | my $self = shift; | ||
| 521 | # spent 827µs (313+514) within Type::Tiny::__ANON__[/Users/ether/.perlbrew/libs/36.0@std/lib/perl5/Type/Tiny.pm:524] which was called 16 times, avg 52µs/call:
# 14 times (289µs+466µs) by Type::Tiny::parameterize at line 1050, avg 54µs/call
# 2 times (24µs+48µs) by Types::Standard::__ANON__[/Users/ether/.perlbrew/libs/36.0@std/lib/perl5/Types/Standard.pm:737] at line 735 of Types/Standard.pm, avg 36µs/call | ||||
| 522 | 16 | 255µs | 66 | 584µs | defined && s/[\x00-\x1F]//smg for ( my ( $s, @a ) = @_ ); # spent 345µs making 33 calls to Type::Tiny::CORE:subst, avg 10µs/call
# spent 239µs making 33 calls to Type::Tiny::__ANON__[Type/Tiny.pm:100], avg 7µs/call |
| 523 | 16 | 137µs | 33 | 169µs | sprintf( '%s[%s]', $s, join q[,], map !defined() ? 'undef' : !ref() && /\W/ ? B::perlstring($_) : $_, @a ); # spent 169µs making 33 calls to Type::Tiny::__ANON__[Type/Tiny.pm:100], avg 5µs/call |
| 524 | 5 | 22µs | }; | ||
| 525 | } | ||||
| 526 | |||||
| 527 | # spent 21.2ms (1.10+20.1) within Type::Tiny::_build_compiled_check which was called 62 times, avg 342µs/call:
# 56 times (977µs+18.9ms) by Type::Tiny::compiled_check at line 437, avg 355µs/call
# 4 times (88µs+848µs) by Type::Tiny::Enum::_build_compiled_check at line 198 of Type/Tiny/Enum.pm, avg 234µs/call
# 2 times (32µs+329µs) by Type::Tiny::check at line 758, avg 180µs/call | ||||
| 528 | 62 | 18µs | my $self = shift; | ||
| 529 | |||||
| 530 | 62 | 22µs | local our $AvoidCallbacks = 0; | ||
| 531 | |||||
| 532 | 62 | 181µs | 105 | 382µs | if ( $self->_is_null_constraint and $self->has_parent ) { # spent 336µs making 50 calls to Type::Tiny::_is_null_constraint, avg 7µs/call
# spent 21µs making 15 calls to Type::Tiny::has_parent, avg 1µs/call
# spent 11µs making 14 calls to Type::Tiny::parent, avg 786ns/call
# spent 8µs making 7 calls to Type::Tiny::Class::_is_null_constraint, avg 1µs/call
# spent 4µs making 4 calls to Type::Tiny::Enum::_is_null_constraint, avg 1µs/call
# spent 2µs making 1 call to Type::Tiny::Duck::_is_null_constraint
# spent 24µs making 14 calls to Type::Tiny::compiled_check, avg 2µs/call, recursion: max depth 1, sum of overlapping time 24µs |
| 533 | return $self->parent->compiled_check; | ||||
| 534 | } | ||||
| 535 | |||||
| 536 | 48 | 44µs | require Eval::TypeTiny; | ||
| 537 | 48 | 652µs | 192 | 19.7ms | return Eval::TypeTiny::eval_closure( # spent 9.79ms making 44 calls to Type::Tiny::inline_check, avg 223µs/call
# spent 8.58ms making 48 calls to Eval::TypeTiny::eval_closure, avg 179µs/call
# spent 702µs making 48 calls to Type::Tiny::__ANON__[Type/Tiny.pm:100], avg 15µs/call
# spent 560µs making 44 calls to Type::Tiny::can_be_inlined, avg 13µs/call
# spent 61µs making 4 calls to Type::Tiny::Enum::inline_check, avg 15µs/call
# spent 4µs making 4 calls to Type::Tiny::Enum::can_be_inlined, avg 1µs/call |
| 538 | source => sprintf( 'sub ($) { %s }', $self->inline_check( '$_[0]' ) ), | ||||
| 539 | description => sprintf( "compiled check '%s'", $self ), | ||||
| 540 | ) if $self->can_be_inlined; | ||||
| 541 | |||||
| 542 | my @constraints; | ||||
| 543 | push @constraints, $self->parent->compiled_check if $self->has_parent; | ||||
| 544 | push @constraints, $self->constraint if !$self->_is_null_constraint; | ||||
| 545 | return $null_constraint unless @constraints; | ||||
| 546 | |||||
| 547 | return sub ($) { | ||||
| 548 | local $_ = $_[0]; | ||||
| 549 | for my $c ( @constraints ) { | ||||
| 550 | return unless $c->( @_ ); | ||||
| 551 | } | ||||
| 552 | return !!1; | ||||
| 553 | }; | ||||
| 554 | } #/ sub _build_compiled_check | ||||
| 555 | |||||
| 556 | # spent 27µs (12+15) within Type::Tiny::find_constraining_type which was called 6 times, avg 4µs/call:
# 3 times (8µs+9µs) by Type::Tiny::__ANON__[/Users/ether/.perlbrew/libs/36.0@std/lib/perl5/Type/Tiny.pm:659] at line 613, avg 6µs/call
# 3 times (4µs+6µs) by Type::Tiny::__ANON__[/Users/ether/.perlbrew/libs/36.0@std/lib/perl5/Type/Tiny.pm:659] at line 614, avg 3µs/call | ||||
| 557 | 6 | 1µs | my $self = shift; | ||
| 558 | 6 | 5µs | 6 | 15µs | if ( $self->_is_null_constraint and $self->has_parent ) { # spent 15µs making 6 calls to Type::Tiny::_is_null_constraint, avg 2µs/call |
| 559 | return $self->parent->find_constraining_type; | ||||
| 560 | } | ||||
| 561 | 6 | 8µs | $self; | ||
| 562 | } | ||||
| 563 | |||||
| 564 | # spent 114µs (102+12) within Type::Tiny::type_default which was called 17 times, avg 7µs/call:
# 8 times (22µs+0s) by Types::Standard::__ANON__[/Users/ether/.perlbrew/libs/36.0@std/lib/perl5/Types/Standard.pm:532] at line 530 of Types/Standard.pm, avg 3µs/call
# 4 times (15µs+0s) by Types::Standard::__ANON__[/Users/ether/.perlbrew/libs/36.0@std/lib/perl5/Types/Standard.pm:510] at line 508 of Types/Standard.pm, avg 4µs/call
# 2 times (5µs+0s) by Types::Standard::__ANON__[/Users/ether/.perlbrew/libs/36.0@std/lib/perl5/Types/Standard.pm:737] at line 735 of Types/Standard.pm, avg 2µs/call
# once (52µs+18µs) by Types::Standard::__ANON__[/Users/ether/.perlbrew/libs/36.0@std/lib/perl5/Types/Standard.pm:661] at line 660 of Types/Standard.pm
# once (2µs+0s) by Types::Standard::__ANON__[/Users/ether/.perlbrew/libs/36.0@std/lib/perl5/Types/Standard.pm:704] at line 703 of Types/Standard.pm
# once (6µs+-6µs) by Type::Tiny::type_default at line 573 | ||||
| 565 | 17 | 8µs | my ( $self, @args ) = @_; | ||
| 566 | 17 | 11µs | if ( exists $self->{type_default} ) { | ||
| 567 | 16 | 1µs | if ( @args ) { | ||
| 568 | my $td = $self->{type_default}; | ||||
| 569 | return sub { local $_ = \@args; &$td; }; | ||||
| 570 | } | ||||
| 571 | 16 | 50µs | return $self->{type_default}; | ||
| 572 | } | ||||
| 573 | 1 | 15µs | 4 | 12µs | if ( my $parent = $self->parent ) { # spent 7µs making 1 call to Type::Tiny::_is_null_constraint
# spent 4µs making 1 call to Type::Tiny::__ANON__[Type/Tiny.pm:101]
# spent 1µs making 1 call to Type::Tiny::parent
# spent 6µs making 1 call to Type::Tiny::type_default, recursion: max depth 1, sum of overlapping time 6µs |
| 574 | return $parent->type_default( @args ) if $self->_is_null_constraint; | ||||
| 575 | } | ||||
| 576 | return undef; | ||||
| 577 | } | ||||
| 578 | |||||
| 579 | our @CMP; | ||||
| 580 | |||||
| 581 | sub CMP_SUPERTYPE () { -1 } | ||||
| 582 | sub CMP_EQUAL () { 0 } | ||||
| 583 | sub CMP_EQUIVALENT () { '0E0' } | ||||
| 584 | sub CMP_SUBTYPE () { 1 } | ||||
| 585 | sub CMP_UNKNOWN () { ''; } | ||||
| 586 | |||||
| 587 | # avoid getting mixed up with cmp operator at compile time | ||||
| 588 | # spent 4.97ms (64µs+4.91) within Type::Tiny::__ANON__[/Users/ether/.perlbrew/libs/36.0@std/lib/perl5/Type/Tiny.pm:602] which was called 3 times, avg 1.66ms/call:
# 3 times (64µs+4.91ms) by Type::Tiny::is_a_type_of at line 680, avg 1.66ms/call | ||||
| 589 | 3 | 3µs | 3 | 27µs | my ( $A, $B ) = _loose_to_TypeTiny( $_[0], $_[1] ); # spent 27µs making 3 calls to Type::Tiny::_loose_to_TypeTiny, avg 9µs/call |
| 590 | 3 | 13µs | 6 | 26µs | return unless blessed( $A ) && $A->isa( "Type::Tiny" ); # spent 24µs making 3 calls to Type::Tiny::isa, avg 8µs/call
# spent 2µs making 3 calls to Scalar::Util::blessed, avg 667ns/call |
| 591 | 3 | 23µs | 6 | 9µs | return unless blessed( $B ) && $B->isa( "Type::Tiny" ); # spent 5µs making 3 calls to Type::Tiny::isa, avg 2µs/call
# spent 4µs making 3 calls to Scalar::Util::blessed, avg 1µs/call |
| 592 | 3 | 3µs | for my $comparator ( @CMP ) { | ||
| 593 | 3 | 4µs | 3 | 4.84ms | my $result = $comparator->( $A, $B ); # spent 4.84ms making 3 calls to Type::Tiny::__ANON__[Type/Tiny.pm:659], avg 1.61ms/call |
| 594 | 3 | 2µs | next if $result eq CMP_UNKNOWN; | ||
| 595 | 3 | 1µs | if ( $result eq CMP_EQUIVALENT ) { | ||
| 596 | my $prefer = @_ == 3 ? $_[2] : CMP_EQUAL; | ||||
| 597 | return $prefer; | ||||
| 598 | } | ||||
| 599 | 3 | 11µs | return $result; | ||
| 600 | } | ||||
| 601 | return CMP_UNKNOWN; | ||||
| 602 | 1 | 3µs | }; | ||
| 603 | |||||
| 604 | # spent 4.84ms (257µs+4.59) within Type::Tiny::__ANON__[/Users/ether/.perlbrew/libs/36.0@std/lib/perl5/Type/Tiny.pm:659] which was called 3 times, avg 1.61ms/call:
# 3 times (257µs+4.59ms) by Type::Tiny::__ANON__[/Users/ether/.perlbrew/libs/36.0@std/lib/perl5/Type/Tiny.pm:602] at line 593, avg 1.61ms/call | ||||
| 605 | 3 | 2µs | my ( $A, $B ) = @_; | ||
| 606 | 3 | 10µs | 6 | 3µs | return CMP_EQUAL # spent 3µs making 6 calls to Scalar::Util::refaddr, avg 500ns/call |
| 607 | if Scalar::Util::refaddr( $A ) == Scalar::Util::refaddr( $B ); | ||||
| 608 | |||||
| 609 | 3 | 10µs | 12 | 6µs | return CMP_EQUIVALENT # spent 5µs making 6 calls to Type::Tiny::compiled_check, avg 833ns/call
# spent 1µs making 6 calls to Scalar::Util::refaddr, avg 167ns/call |
| 610 | if Scalar::Util::refaddr( $A->compiled_check ) == | ||||
| 611 | Scalar::Util::refaddr( $B->compiled_check ); | ||||
| 612 | |||||
| 613 | 3 | 5µs | 3 | 17µs | my $A_stem = $A->find_constraining_type; # spent 17µs making 3 calls to Type::Tiny::find_constraining_type, avg 6µs/call |
| 614 | 3 | 2µs | 3 | 10µs | my $B_stem = $B->find_constraining_type; # spent 10µs making 3 calls to Type::Tiny::find_constraining_type, avg 3µs/call |
| 615 | 3 | 8µs | 6 | 2µs | return CMP_EQUIVALENT # spent 2µs making 6 calls to Scalar::Util::refaddr, avg 333ns/call |
| 616 | if Scalar::Util::refaddr( $A_stem ) == Scalar::Util::refaddr( $B_stem ); | ||||
| 617 | 3 | 9µs | 12 | 4µs | return CMP_EQUIVALENT # spent 3µs making 6 calls to Scalar::Util::refaddr, avg 500ns/call
# spent 1µs making 6 calls to Type::Tiny::compiled_check, avg 167ns/call |
| 618 | if Scalar::Util::refaddr( $A_stem->compiled_check ) == | ||||
| 619 | Scalar::Util::refaddr( $B_stem->compiled_check ); | ||||
| 620 | |||||
| 621 | 3 | 9µs | 12 | 1.03ms | if ( $A_stem->can_be_inlined and $B_stem->can_be_inlined ) { # spent 985µs making 6 calls to Type::Tiny::inline_check, avg 164µs/call
# spent 42µs making 6 calls to Type::Tiny::can_be_inlined, avg 7µs/call |
| 622 | return CMP_EQUIVALENT | ||||
| 623 | if $A_stem->inline_check( '$WOLFIE' ) eq $B_stem->inline_check( '$WOLFIE' ); | ||||
| 624 | } | ||||
| 625 | |||||
| 626 | A_IS_SUBTYPE: { | ||||
| 627 | 6 | 2µs | my $A_prime = $A_stem; | ||
| 628 | 3 | 5µs | 3 | 3µs | while ( $A_prime->has_parent ) { # spent 3µs making 3 calls to Type::Tiny::has_parent, avg 1µs/call |
| 629 | 12 | 4µs | 12 | 5µs | $A_prime = $A_prime->parent; # spent 5µs making 12 calls to Type::Tiny::parent, avg 417ns/call |
| 630 | 12 | 42µs | 24 | 19µs | return CMP_SUBTYPE # spent 19µs making 24 calls to Scalar::Util::refaddr, avg 792ns/call |
| 631 | if Scalar::Util::refaddr( $A_prime ) == Scalar::Util::refaddr( $B_stem ); | ||||
| 632 | 12 | 34µs | 48 | 19µs | return CMP_SUBTYPE # spent 15µs making 24 calls to Type::Tiny::compiled_check, avg 625ns/call
# spent 4µs making 24 calls to Scalar::Util::refaddr, avg 167ns/call |
| 633 | if Scalar::Util::refaddr( $A_prime->compiled_check ) == | ||||
| 634 | Scalar::Util::refaddr( $B_stem->compiled_check ); | ||||
| 635 | 12 | 32µs | 60 | 3.47ms | if ( $A_prime->can_be_inlined and $B_stem->can_be_inlined ) { # spent 3.23ms making 24 calls to Type::Tiny::inline_check, avg 134µs/call
# spent 234µs making 24 calls to Type::Tiny::can_be_inlined, avg 10µs/call
# spent 6µs making 12 calls to Type::Tiny::has_parent, avg 500ns/call |
| 636 | return CMP_SUBTYPE | ||||
| 637 | if $A_prime->inline_check( '$WOLFIE' ) eq $B_stem->inline_check( '$WOLFIE' ); | ||||
| 638 | } | ||||
| 639 | } #/ while ( $A_prime->has_parent) | ||||
| 640 | } #/ A_IS_SUBTYPE: | ||||
| 641 | |||||
| 642 | B_IS_SUBTYPE: { | ||||
| 643 | 6 | 2µs | my $B_prime = $B_stem; | ||
| 644 | 3 | 2µs | 3 | 1µs | while ( $B_prime->has_parent ) { # spent 1µs making 3 calls to Type::Tiny::has_parent, avg 333ns/call |
| 645 | 3 | 1µs | 3 | 1µs | $B_prime = $B_prime->parent; # spent 1µs making 3 calls to Type::Tiny::parent, avg 333ns/call |
| 646 | 3 | 18µs | 6 | 1µs | return CMP_SUPERTYPE # spent 1µs making 6 calls to Scalar::Util::refaddr, avg 167ns/call |
| 647 | if Scalar::Util::refaddr( $B_prime ) == Scalar::Util::refaddr( $A_stem ); | ||||
| 648 | return CMP_SUPERTYPE | ||||
| 649 | if Scalar::Util::refaddr( $B_prime->compiled_check ) == | ||||
| 650 | Scalar::Util::refaddr( $A_stem->compiled_check ); | ||||
| 651 | if ( $A_stem->can_be_inlined and $B_prime->can_be_inlined ) { | ||||
| 652 | return CMP_SUPERTYPE | ||||
| 653 | if $B_prime->inline_check( '$WOLFIE' ) eq $A_stem->inline_check( '$WOLFIE' ); | ||||
| 654 | } | ||||
| 655 | } #/ while ( $B_prime->has_parent) | ||||
| 656 | } #/ B_IS_SUBTYPE: | ||||
| 657 | |||||
| 658 | return CMP_UNKNOWN; | ||||
| 659 | 1 | 3µs | }; | ||
| 660 | |||||
| 661 | sub equals { | ||||
| 662 | my $result = Type::Tiny::cmp( $_[0], $_[1] ); | ||||
| 663 | return unless defined $result; | ||||
| 664 | $result eq CMP_EQUAL; | ||||
| 665 | } | ||||
| 666 | |||||
| 667 | sub is_subtype_of { | ||||
| 668 | my $result = Type::Tiny::cmp( $_[0], $_[1], CMP_SUBTYPE ); | ||||
| 669 | return unless defined $result; | ||||
| 670 | $result eq CMP_SUBTYPE; | ||||
| 671 | } | ||||
| 672 | |||||
| 673 | sub is_supertype_of { | ||||
| 674 | my $result = Type::Tiny::cmp( $_[0], $_[1], CMP_SUBTYPE ); | ||||
| 675 | return unless defined $result; | ||||
| 676 | $result eq CMP_SUPERTYPE; | ||||
| 677 | } | ||||
| 678 | |||||
| 679 | # spent 4.98ms (16µs+4.97) within Type::Tiny::is_a_type_of which was called 3 times, avg 1.66ms/call:
# 3 times (16µs+4.97ms) by Types::Standard::Dict::__inline_generator at line 100 of Types/Standard/Dict.pm, avg 1.66ms/call | ||||
| 680 | 3 | 4µs | 3 | 4.97ms | my $result = Type::Tiny::cmp( $_[0], $_[1] ); # spent 4.97ms making 3 calls to Type::Tiny::__ANON__[Type/Tiny.pm:602], avg 1.66ms/call |
| 681 | 3 | 1µs | return unless defined $result; | ||
| 682 | 3 | 7µs | $result eq CMP_SUBTYPE or $result eq CMP_EQUAL or $result eq CMP_EQUIVALENT; | ||
| 683 | } | ||||
| 684 | |||||
| 685 | # spent 17.8ms (6.79+11.0) within Type::Tiny::strictly_equals which was called 794 times, avg 22µs/call:
# 597 times (4.88ms+8.09ms) by Type::Tiny::is_strictly_subtype_of at line 698, avg 22µs/call
# 191 times (1.88ms+2.87ms) by Type::Tiny::is_strictly_a_type_of at line 715, avg 25µs/call
# 6 times (35µs+74µs) by Types::Standard::Dict::__inline_generator at line 103 of Types/Standard/Dict.pm, avg 18µs/call | ||||
| 686 | 794 | 643µs | 794 | 6.71ms | my ( $self, $other ) = _loose_to_TypeTiny( @_ ); # spent 6.71ms making 794 calls to Type::Tiny::_loose_to_TypeTiny, avg 8µs/call |
| 687 | 794 | 2.12ms | 1588 | 2.45ms | return unless blessed( $self ) && $self->isa( "Type::Tiny" ); # spent 1.98ms making 794 calls to Type::Tiny::isa, avg 2µs/call
# spent 468µs making 794 calls to Scalar::Util::blessed, avg 589ns/call |
| 688 | 794 | 1.83ms | 1588 | 1.88ms | return unless blessed( $other ) && $other->isa( "Type::Tiny" ); # spent 1.56ms making 794 calls to Type::Tiny::isa, avg 2µs/call
# spent 317µs making 794 calls to Scalar::Util::blessed, avg 399ns/call |
| 689 | 794 | 1.71ms | $self->{uniq} == $other->{uniq}; | ||
| 690 | } | ||||
| 691 | |||||
| 692 | sub is_strictly_subtype_of { | ||||
| 693 | 703 | 528µs | 703 | 5.39ms | my ( $self, $other ) = _loose_to_TypeTiny( @_ ); # spent 5.39ms making 703 calls to Type::Tiny::_loose_to_TypeTiny, avg 8µs/call |
| 694 | 703 | 1.66ms | 1406 | 2.03ms | return unless blessed( $self ) && $self->isa( "Type::Tiny" ); # spent 1.71ms making 703 calls to Type::Tiny::isa, avg 2µs/call
# spent 321µs making 703 calls to Scalar::Util::blessed, avg 457ns/call |
| 695 | 703 | 1.65ms | 1406 | 1.78ms | return unless blessed( $other ) && $other->isa( "Type::Tiny" ); # spent 1.47ms making 703 calls to Type::Tiny::isa, avg 2µs/call
# spent 318µs making 703 calls to Scalar::Util::blessed, avg 452ns/call |
| 696 | |||||
| 697 | 703 | 748µs | 703 | 470µs | return unless $self->has_parent; # spent 422µs making 639 calls to Type::Tiny::has_parent, avg 660ns/call
# spent 29µs making 42 calls to Type::Tiny::ConstrainedObject::has_parent, avg 690ns/call
# spent 19µs making 22 calls to Type::Tiny::Enum::has_parent, avg 864ns/call |
| 698 | 597 | 2.40ms | 2218 | 14.4ms | $self->parent->strictly_equals( $other ) # spent 13.0ms making 597 calls to Type::Tiny::strictly_equals, avg 22µs/call
# spent 667µs making 84 calls to Type::Tiny::Class::parent, avg 8µs/call
# spent 575µs making 981 calls to Type::Tiny::parent, avg 586ns/call
# spent 181µs making 44 calls to Type::Tiny::Enum::parent, avg 4µs/call
# spent 61.1ms making 512 calls to Type::Tiny::is_strictly_subtype_of, avg 119µs/call, recursion: max depth 7, sum of overlapping time 61.1ms |
| 699 | or $self->parent->is_strictly_subtype_of( $other ); | ||||
| 700 | } | ||||
| 701 | |||||
| 702 | sub is_strictly_supertype_of { | ||||
| 703 | my ( $self, $other ) = _loose_to_TypeTiny( @_ ); | ||||
| 704 | return unless blessed( $self ) && $self->isa( "Type::Tiny" ); | ||||
| 705 | return unless blessed( $other ) && $other->isa( "Type::Tiny" ); | ||||
| 706 | |||||
| 707 | $other->is_strictly_subtype_of( $self ); | ||||
| 708 | } | ||||
| 709 | |||||
| 710 | # spent 44.8ms (2.66+42.1) within Type::Tiny::is_strictly_a_type_of which was called 191 times, avg 234µs/call:
# 134 times (1.89ms+30.4ms) by Types::Standard::Dict::__ANON__[/Users/ether/.perlbrew/libs/36.0@std/lib/perl5/Types/Standard/Dict.pm:161] at line 156 of Types/Standard/Dict.pm, avg 241µs/call
# 32 times (339µs+5.82ms) by Types::Standard::Dict::__constraint_generator at line 64 of Types/Standard/Dict.pm, avg 193µs/call
# 4 times (48µs+1.44ms) by Types::Standard::Tuple::__constraint_generator at line 59 of Types/Standard/Tuple.pm, avg 372µs/call
# 4 times (52µs+1.39ms) by Types::Standard::Tuple::__inline_generator at line 133 of Types/Standard/Tuple.pm, avg 362µs/call
# 4 times (168µs+712µs) by Types::Standard::Dict::__constraint_generator at line 44 of Types/Standard/Dict.pm, avg 220µs/call
# 4 times (50µs+435µs) by Types::Standard::__ANON__[/Users/ether/.perlbrew/libs/36.0@std/lib/perl5/Types/Standard.pm:826] at line 815 of Types/Standard.pm, avg 121µs/call
# 4 times (34µs+359µs) by Types::Standard::Dict::__inline_generator at line 90 of Types/Standard/Dict.pm, avg 98µs/call
# 2 times (33µs+673µs) by Types::Standard::Tuple::__constraint_generator at line 28 of Types/Standard/Tuple.pm, avg 353µs/call
# 2 times (27µs+582µs) by Types::Standard::Tuple::__inline_generator at line 95 of Types/Standard/Tuple.pm, avg 304µs/call
# once (19µs+274µs) by Types::Standard::Dict::__coercion_generator at line 244 of Types/Standard/Dict.pm | ||||
| 711 | 191 | 231µs | 191 | 1.89ms | my ( $self, $other ) = _loose_to_TypeTiny( @_ ); # spent 1.89ms making 191 calls to Type::Tiny::_loose_to_TypeTiny, avg 10µs/call |
| 712 | 191 | 683µs | 382 | 789µs | return unless blessed( $self ) && $self->isa( "Type::Tiny" ); # spent 653µs making 191 calls to Type::Tiny::isa, avg 3µs/call
# spent 136µs making 191 calls to Scalar::Util::blessed, avg 712ns/call |
| 713 | 191 | 553µs | 382 | 569µs | return unless blessed( $other ) && $other->isa( "Type::Tiny" ); # spent 471µs making 191 calls to Type::Tiny::isa, avg 2µs/call
# spent 98µs making 191 calls to Scalar::Util::blessed, avg 513ns/call |
| 714 | |||||
| 715 | 191 | 745µs | 382 | 38.9ms | $self->strictly_equals( $other ) or $self->is_strictly_subtype_of( $other ); # spent 34.1ms making 191 calls to Type::Tiny::is_strictly_subtype_of, avg 179µs/call
# spent 4.74ms making 191 calls to Type::Tiny::strictly_equals, avg 25µs/call |
| 716 | } | ||||
| 717 | |||||
| 718 | # spent 294µs (247+47) within Type::Tiny::qualified_name which was called 46 times, avg 6µs/call:
# 37 times (195µs+36µs) by Eval::TypeTiny::type_to_coderef at line 169 of Eval/TypeTiny.pm, avg 6µs/call
# 7 times (46µs+10µs) by Types::Standard::__ANON__[/Users/ether/.perlbrew/libs/36.0@std/lib/perl5/Types/Standard.pm:190] at line 186 of Types/Standard.pm, avg 8µs/call
# 2 times (6µs+1000ns) by Type::Tiny::new at line 364, avg 4µs/call | ||||
| 719 | 46 | 14µs | my $self = shift; | ||
| 720 | ( exists $self->{library} and $self->name ne "__ANON__" ) | ||||
| 721 | ? "$self->{library}::$self->{name}" | ||||
| 722 | 46 | 242µs | 46 | 47µs | : $self->{name}; # spent 47µs making 46 calls to Type::Tiny::name, avg 1µs/call |
| 723 | } | ||||
| 724 | |||||
| 725 | # spent 565µs (439+126) within Type::Tiny::is_anon which was called 129 times, avg 4µs/call:
# 54 times (182µs+70µs) by Type::Tiny::_build_coercion at line 502, avg 5µs/call
# 38 times (70µs+21µs) by Type::Tiny::exportables at line 1187, avg 2µs/call
# 37 times (187µs+35µs) by Type::Library::add_type at line 228 of Type/Library.pm, avg 6µs/call | ||||
| 726 | 129 | 24µs | my $self = shift; | ||
| 727 | 129 | 365µs | 129 | 126µs | $self->name eq "__ANON__"; # spent 126µs making 129 calls to Type::Tiny::name, avg 977ns/call |
| 728 | } | ||||
| 729 | |||||
| 730 | sub parents { | ||||
| 731 | my $self = shift; | ||||
| 732 | return unless $self->has_parent; | ||||
| 733 | return ( $self->parent, $self->parent->parents ); | ||||
| 734 | } | ||||
| 735 | |||||
| 736 | # spent 68µs (56+12) within Type::Tiny::find_parent which was called 2 times, avg 34µs/call:
# 2 times (56µs+12µs) by Types::Standard::Slurpy::my_unslurpy at line 751 of Types/Standard.pm, avg 34µs/call | ||||
| 737 | 2 | 0s | my $self = shift; | ||
| 738 | 2 | 2µs | my ( $test ) = @_; | ||
| 739 | |||||
| 740 | 2 | 4µs | local ( $_, $. ); | ||
| 741 | 2 | 6µs | my $type = $self; | ||
| 742 | 2 | 2µs | my $count = 0; | ||
| 743 | 2 | 5µs | 2 | 4µs | while ( $type ) { # spent 4µs making 2 calls to Type::Tiny::__ANON__[Type/Tiny.pm:101], avg 2µs/call |
| 744 | 2 | 27µs | 2 | 8µs | if ( $test->( $_ = $type, $. = $count ) ) { # spent 8µs making 2 calls to Types::Standard::__ANON__[Types/Standard.pm:750], avg 4µs/call |
| 745 | return wantarray ? ( $type, $count ) : $type; | ||||
| 746 | } | ||||
| 747 | else { | ||||
| 748 | $type = $type->parent; | ||||
| 749 | $count++; | ||||
| 750 | } | ||||
| 751 | } | ||||
| 752 | |||||
| 753 | return; | ||||
| 754 | } #/ sub find_parent | ||||
| 755 | |||||
| 756 | # spent 3.66ms (939µs+2.72) within Type::Tiny::check which was called 381 times, avg 10µs/call:
# 343 times (856µs+2.52ms) by Types::TypeTiny::is_TypeTiny at line 2 of (eval 40)[Types/TypeTiny.pm:58], avg 10µs/call
# 38 times (83µs+198µs) by Types::TypeTiny::is_StringLike at line 2 of (eval 39)[Types/TypeTiny.pm:58], avg 7µs/call | ||||
| 757 | 381 | 65µs | my $self = shift; | ||
| 758 | 381 | 878µs | 383 | 2.72ms | ( $self->{compiled_type_constraint} ||= $self->_build_compiled_check )->( @_ ); # spent 2.32ms making 343 calls to Eval::TypeTiny::Sandbox::__ANON__[(eval 57)[Eval/TypeTiny.pm:8]:3], avg 7µs/call
# spent 361µs making 2 calls to Type::Tiny::_build_compiled_check, avg 180µs/call
# spent 39µs making 38 calls to Eval::TypeTiny::Sandbox::__ANON__[(eval 58)[Eval/TypeTiny.pm:8]:3], avg 1µs/call |
| 759 | } | ||||
| 760 | |||||
| 761 | sub _strict_check { | ||||
| 762 | my $self = shift; | ||||
| 763 | local $_ = $_[0]; | ||||
| 764 | |||||
| 765 | my @constraints = | ||||
| 766 | reverse | ||||
| 767 | map { $_->constraint } | ||||
| 768 | grep { not $_->_is_null_constraint } ( $self, $self->parents ); | ||||
| 769 | |||||
| 770 | for my $c ( @constraints ) { | ||||
| 771 | return unless $c->( @_ ); | ||||
| 772 | } | ||||
| 773 | |||||
| 774 | return !!1; | ||||
| 775 | } #/ sub _strict_check | ||||
| 776 | |||||
| 777 | sub get_message { | ||||
| 778 | my $self = shift; | ||||
| 779 | local $_ = $_[0]; | ||||
| 780 | $self->has_message | ||||
| 781 | ? $self->message->( @_ ) | ||||
| 782 | : $self->_default_message->( @_ ); | ||||
| 783 | } | ||||
| 784 | |||||
| 785 | sub validate { | ||||
| 786 | my $self = shift; | ||||
| 787 | |||||
| 788 | return undef | ||||
| 789 | if ( $self->{compiled_type_constraint} ||= $self->_build_compiled_check ) | ||||
| 790 | ->( @_ ); | ||||
| 791 | |||||
| 792 | local $_ = $_[0]; | ||||
| 793 | return $self->get_message( @_ ); | ||||
| 794 | } #/ sub validate | ||||
| 795 | |||||
| 796 | sub validate_explain { | ||||
| 797 | my $self = shift; | ||||
| 798 | my ( $value, $varname ) = @_; | ||||
| 799 | $varname = '$_' unless defined $varname; | ||||
| 800 | |||||
| 801 | return undef if $self->check( $value ); | ||||
| 802 | |||||
| 803 | if ( $self->has_parent ) { | ||||
| 804 | my $parent = $self->parent->validate_explain( $value, $varname ); | ||||
| 805 | return [ | ||||
| 806 | sprintf( '"%s" is a subtype of "%s"', $self, $self->parent ), | ||||
| 807 | @$parent | ||||
| 808 | ] | ||||
| 809 | if $parent; | ||||
| 810 | } | ||||
| 811 | |||||
| 812 | my $message = sprintf( | ||||
| 813 | '%s%s', | ||||
| 814 | $self->get_message( $value ), | ||||
| 815 | $varname eq q{$_} ? '' : sprintf( ' (in %s)', $varname ), | ||||
| 816 | ); | ||||
| 817 | |||||
| 818 | if ( $self->is_parameterized and $self->parent->has_deep_explanation ) { | ||||
| 819 | my $deep = $self->parent->deep_explanation->( $self, $value, $varname ); | ||||
| 820 | return [ $message, @$deep ] if $deep; | ||||
| 821 | } | ||||
| 822 | |||||
| 823 | local $SIG{__WARN__} = sub {}; | ||||
| 824 | return [ | ||||
| 825 | $message, | ||||
| 826 | sprintf( '"%s" is defined as: %s', $self, $self->_perlcode ) | ||||
| 827 | ]; | ||||
| 828 | } #/ sub validate_explain | ||||
| 829 | |||||
| 830 | 1 | 0s | my $b; | ||
| 831 | |||||
| 832 | sub _perlcode { | ||||
| 833 | my $self = shift; | ||||
| 834 | |||||
| 835 | local our $AvoidCallbacks = 1; | ||||
| 836 | return $self->inline_check( '$_' ) | ||||
| 837 | if $self->can_be_inlined; | ||||
| 838 | |||||
| 839 | $b ||= do { | ||||
| 840 | local $@; | ||||
| 841 | require B::Deparse; | ||||
| 842 | my $tmp = "B::Deparse"->new; | ||||
| 843 | $tmp->ambient_pragmas( strict => "all", warnings => "all" ) | ||||
| 844 | if $tmp->can( 'ambient_pragmas' ); | ||||
| 845 | $tmp; | ||||
| 846 | }; | ||||
| 847 | |||||
| 848 | my $code = $b->coderef2text( $self->constraint ); | ||||
| 849 | $code =~ s/\s+/ /g; | ||||
| 850 | return "sub $code"; | ||||
| 851 | } #/ sub _perlcode | ||||
| 852 | |||||
| 853 | sub assert_valid { | ||||
| 854 | my $self = shift; | ||||
| 855 | |||||
| 856 | return !!1 | ||||
| 857 | if ( $self->{compiled_type_constraint} ||= $self->_build_compiled_check ) | ||||
| 858 | ->( @_ ); | ||||
| 859 | |||||
| 860 | local $_ = $_[0]; | ||||
| 861 | $self->_failed_check( "$self", $_ ); | ||||
| 862 | } #/ sub assert_valid | ||||
| 863 | |||||
| 864 | sub assert_return { | ||||
| 865 | my $self = shift; | ||||
| 866 | |||||
| 867 | return $_[0] | ||||
| 868 | if ( $self->{compiled_type_constraint} ||= $self->_build_compiled_check ) | ||||
| 869 | ->( @_ ); | ||||
| 870 | |||||
| 871 | local $_ = $_[0]; | ||||
| 872 | $self->_failed_check( "$self", $_ ); | ||||
| 873 | } #/ sub assert_return | ||||
| 874 | |||||
| 875 | # spent 12.1ms (7.55+4.59) within Type::Tiny::can_be_inlined which was called 1026 times, avg 12µs/call:
# 638 times (4.34ms+2.93ms) by Type::Tiny::inline_check at line 886, avg 11µs/call
# 126 times (1.03ms+858µs) by Type::Tiny::inline_assert at line 915, avg 15µs/call
# 60 times (374µs+-374µs) by Type::Tiny::can_be_inlined at line 877, avg 0s/call
# 44 times (388µs+172µs) by Type::Tiny::_build_compiled_check at line 537, avg 13µs/call
# 37 times (452µs+406µs) by Type::Tiny::_overload_coderef at line 215, avg 23µs/call
# 30 times (133µs+80µs) by Types::Standard::Dict::__inline_generator at line 117 of Types/Standard/Dict.pm, avg 7µs/call
# 24 times (154µs+80µs) by Type::Tiny::__ANON__[/Users/ether/.perlbrew/libs/36.0@std/lib/perl5/Type/Tiny.pm:659] at line 635, avg 10µs/call
# 23 times (234µs+152µs) by Type::Tiny::_overload_coderef at line 203, avg 17µs/call
# 8 times (75µs+61µs) by Types::Standard::HashRef::__inline_generator at line 65 of Types/Standard/HashRef.pm, avg 17µs/call
# 6 times (29µs+17µs) by Type::Tiny::Union::can_be_inlined at line 117 of Type/Tiny/Union.pm, avg 8µs/call
# 6 times (30µs+12µs) by Type::Tiny::__ANON__[/Users/ether/.perlbrew/libs/36.0@std/lib/perl5/Type/Tiny.pm:659] at line 621, avg 7µs/call
# 5 times (93µs+47µs) by Type::Tiny::new at line 277, avg 28µs/call
# 4 times (54µs+20µs) by Types::Standard::ArrayRef::__inline_generator at line 100 of Types/Standard/ArrayRef.pm, avg 18µs/call
# 3 times (47µs+56µs) by Types::Standard::Dict::__inline_generator at line 96 of Types/Standard/Dict.pm, avg 34µs/call
# 2 times (38µs+10µs) by Types::Standard::Map::__inline_generator at line 61 of Types/Standard/Map.pm, avg 24µs/call
# 2 times (19µs+19µs) by Types::Standard::Tuple::__inline_generator at line 103 of Types/Standard/Tuple.pm, avg 19µs/call
# 2 times (19µs+15µs) by Type::Coercion::can_be_inlined at line 318 of Type/Coercion.pm, avg 17µs/call
# 2 times (16µs+11µs) by Types::Standard::__ANON__[/Users/ether/.perlbrew/libs/36.0@std/lib/perl5/Types/Standard.pm:737] at line 735 of Types/Standard.pm, avg 14µs/call
# 2 times (8µs+8µs) by Type::Coercion::can_be_inlined at line 324 of Type/Coercion.pm, avg 8µs/call
# once (11µs+7µs) by Types::Standard::Dict::__coercion_generator at line 256 of Types/Standard/Dict.pm
# once (9µs+5µs) by Types::Standard::__ANON__[/Users/ether/.perlbrew/libs/36.0@std/lib/perl5/Types/Standard.pm:686] at line 681 of Types/Standard.pm | ||||
| 876 | 1026 | 163µs | my $self = shift; | ||
| 877 | 1026 | 1.80ms | 2113 | 3.33ms | return $self->parent->can_be_inlined # spent 2.42ms making 860 calls to Type::Tiny::_is_null_constraint, avg 3µs/call
# spent 703µs making 919 calls to Type::Tiny::has_parent, avg 765ns/call
# spent 104µs making 107 calls to Type::Tiny::ConstrainedObject::has_parent, avg 972ns/call
# spent 73µs making 98 calls to Type::Tiny::Class::_is_null_constraint, avg 745ns/call
# spent 24µs making 60 calls to Type::Tiny::parent, avg 400ns/call
# spent 5µs making 9 calls to Type::Tiny::Duck::_is_null_constraint, avg 556ns/call
# spent 710µs making 60 calls to Type::Tiny::can_be_inlined, avg 12µs/call, recursion: max depth 2, sum of overlapping time 710µs |
| 878 | if $self->has_parent && $self->_is_null_constraint; | ||||
| 879 | 966 | 903µs | 1025 | 644µs | return !!1 # spent 461µs making 859 calls to Type::Tiny::has_parent, avg 537ns/call
# spent 142µs making 59 calls to Type::Tiny::_is_null_constraint, avg 2µs/call
# spent 41µs making 107 calls to Type::Tiny::ConstrainedObject::has_parent, avg 383ns/call |
| 880 | if !$self->has_parent && $self->_is_null_constraint; | ||||
| 881 | 911 | 2.10ms | 911 | 619µs | return $self->has_inlined; # spent 541µs making 804 calls to Type::Tiny::has_inlined, avg 673ns/call
# spent 71µs making 98 calls to Type::Tiny::Class::has_inlined, avg 724ns/call
# spent 7µs making 9 calls to Type::Tiny::Duck::has_inlined, avg 778ns/call |
| 882 | } | ||||
| 883 | |||||
| 884 | # spent 60.7ms (11.6+49.1) within Type::Tiny::inline_check which was called 638 times, avg 95µs/call:
# 126 times (2.44ms+44.1ms) by Type::Tiny::inline_assert at line 915, avg 369µs/call
# 118 times (2.38ms+-2.38ms) by Types::Standard::Dict::__ANON__[/Users/ether/.perlbrew/libs/36.0@std/lib/perl5/Types/Standard/Dict.pm:161] at line 156 of Types/Standard/Dict.pm, avg 0s/call
# 57 times (1.09ms+-1.09ms) by Types::Standard::__ANON__[/Users/ether/.perlbrew/libs/36.0@std/lib/perl5/Types/Standard.pm:685] at line 684 of Types/Standard.pm, avg 0s/call
# 50 times (559µs+-559µs) by Types::Standard::Dict::__ANON__[/Users/ether/.perlbrew/libs/36.0@std/lib/perl5/Types/Standard/Dict.pm:161] at line 148 of Types/Standard/Dict.pm, avg 0s/call
# 44 times (898µs+8.89ms) by Type::Tiny::_build_compiled_check at line 537, avg 223µs/call
# 37 times (574µs+-574µs) by Types::Standard::HashRef::__ANON__[/Users/ether/.perlbrew/libs/36.0@std/lib/perl5/Types/Standard/HashRef.pm:76] at line 70 of Types/Standard/HashRef.pm, avg 0s/call
# 37 times (657µs+-657µs) by Types::Standard::HashRef::__ANON__[/Users/ether/.perlbrew/libs/36.0@std/lib/perl5/Types/Standard/HashRef.pm:76] at line 69 of Types/Standard/HashRef.pm, avg 0s/call
# 32 times (675µs+-675µs) by Type::Tiny::inline_check at line 899, avg 0s/call
# 24 times (195µs+3.03ms) by Type::Tiny::__ANON__[/Users/ether/.perlbrew/libs/36.0@std/lib/perl5/Type/Tiny.pm:659] at line 635, avg 134µs/call
# 24 times (581µs+-581µs) by Types::Standard::ArrayRef::__ANON__[/Users/ether/.perlbrew/libs/36.0@std/lib/perl5/Types/Standard/ArrayRef.pm:121] at line 114 of Types/Standard/ArrayRef.pm, avg 0s/call
# 24 times (383µs+-383µs) by Types::Standard::ArrayRef::__ANON__[/Users/ether/.perlbrew/libs/36.0@std/lib/perl5/Types/Standard/ArrayRef.pm:121] at line 105 of Types/Standard/ArrayRef.pm, avg 0s/call
# 20 times (293µs+-293µs) by Type::Tiny::inline_check at line 889, avg 0s/call
# 16 times (278µs+-278µs) by Types::Standard::Tuple::__ANON__[/Users/ether/.perlbrew/libs/36.0@std/lib/perl5/Types/Standard/Tuple.pm:164] at line 157 of Types/Standard/Tuple.pm, avg 0s/call
# 6 times (79µs+906µs) by Type::Tiny::__ANON__[/Users/ether/.perlbrew/libs/36.0@std/lib/perl5/Type/Tiny.pm:659] at line 621, avg 164µs/call
# 4 times (47µs+65µs) by Type::Tiny::Union::inline_check at line 140 of Type/Tiny/Union.pm, avg 28µs/call
# 3 times (111µs+-111µs) by Types::Standard::Map::__ANON__[/Users/ether/.perlbrew/libs/36.0@std/lib/perl5/Types/Standard/Map.pm:87] at line 79 of Types/Standard/Map.pm, avg 0s/call
# 3 times (43µs+-43µs) by Types::Standard::Map::__ANON__[/Users/ether/.perlbrew/libs/36.0@std/lib/perl5/Types/Standard/Map.pm:87] at line 78 of Types/Standard/Map.pm, avg 0s/call
# 3 times (37µs+-37µs) by Types::Standard::Map::__ANON__[/Users/ether/.perlbrew/libs/36.0@std/lib/perl5/Types/Standard/Map.pm:87] at line 80 of Types/Standard/Map.pm, avg 0s/call
# 2 times (32µs+36µs) by Type::Coercion::inline_coercion at line 368 of Type/Coercion.pm, avg 34µs/call
# 2 times (23µs+-23µs) by Types::Standard::__ANON__[/Users/ether/.perlbrew/libs/36.0@std/lib/perl5/Types/Standard.pm:328] at line 318 of Types/Standard.pm, avg 0s/call
# 2 times (53µs+-53µs) by Types::Standard::__ANON__[/Users/ether/.perlbrew/libs/36.0@std/lib/perl5/Types/Standard.pm:734] at line 734 of Types/Standard.pm, avg 0s/call
# 2 times (33µs+-33µs) by Types::Standard::__ANON__[/Users/ether/.perlbrew/libs/36.0@std/lib/perl5/Types/Standard.pm:945] at line 940 of Types/Standard.pm, avg 0s/call
# 2 times (102µs+-102µs) by Types::Standard::__ANON__[/Users/ether/.perlbrew/libs/36.0@std/lib/perl5/Types/Standard.pm:921] at line 910 of Types/Standard.pm, avg 0s/call | ||||
| 885 | 638 | 110µs | my $self = shift; | ||
| 886 | 638 | 630µs | 638 | 7.27ms | _croak 'Cannot inline type constraint check for "%s"', $self # spent 7.27ms making 638 calls to Type::Tiny::can_be_inlined, avg 11µs/call |
| 887 | unless $self->can_be_inlined; | ||||
| 888 | |||||
| 889 | 638 | 907µs | 1288 | 1.72ms | return $self->parent->inline_check( @_ ) # spent 1.38ms making 547 calls to Type::Tiny::_is_null_constraint, avg 3µs/call
# spent 289µs making 575 calls to Type::Tiny::has_parent, avg 503ns/call
# spent 21µs making 63 calls to Type::Tiny::ConstrainedObject::has_parent, avg 333ns/call
# spent 17µs making 59 calls to Type::Tiny::Class::_is_null_constraint, avg 288ns/call
# spent 12µs making 20 calls to Type::Tiny::parent, avg 600ns/call
# spent 1µs making 4 calls to Type::Tiny::Duck::_is_null_constraint, avg 250ns/call
# spent 781µs making 20 calls to Type::Tiny::inline_check, avg 39µs/call, recursion: max depth 2, sum of overlapping time 781µs |
| 890 | if $self->has_parent && $self->_is_null_constraint; | ||||
| 891 | 618 | 507µs | 646 | 402µs | return '(!!1)' # spent 295µs making 555 calls to Type::Tiny::has_parent, avg 532ns/call
# spent 86µs making 28 calls to Type::Tiny::_is_null_constraint, avg 3µs/call
# spent 21µs making 63 calls to Type::Tiny::ConstrainedObject::has_parent, avg 333ns/call |
| 892 | if !$self->has_parent && $self->_is_null_constraint; | ||||
| 893 | |||||
| 894 | 592 | 203µs | local $_ = $_[0]; | ||
| 895 | 592 | 1.70ms | 1184 | 81.6ms | my @r = $self->inlined->( $self, @_ ); # spent 48.0ms making 24 calls to Types::Standard::Dict::__ANON__[Types/Standard/Dict.pm:161], avg 2.00ms/call
# spent 21.9ms making 37 calls to Types::Standard::HashRef::__ANON__[Types/Standard/HashRef.pm:76], avg 591µs/call
# spent 3.40ms making 24 calls to Types::Standard::ArrayRef::__ANON__[Types/Standard/ArrayRef.pm:121], avg 142µs/call
# spent 2.44ms making 57 calls to Types::Standard::__ANON__[Types/Standard.pm:685], avg 43µs/call
# spent 2.00ms making 8 calls to Types::Standard::Tuple::__ANON__[Types/Standard/Tuple.pm:164], avg 250µs/call
# spent 906µs making 2 calls to Types::Standard::__ANON__[Types/Standard.pm:734], avg 453µs/call
# spent 692µs making 3 calls to Types::Standard::Map::__ANON__[Types/Standard/Map.pm:87], avg 231µs/call
# spent 388µs making 529 calls to Type::Tiny::inlined, avg 733ns/call
# spent 237µs making 30 calls to Type::Tiny::__ANON__[Type/Tiny.pm:276], avg 8µs/call
# spent 215µs making 59 calls to Type::Tiny::Class::inlined, avg 4µs/call
# spent 201µs making 59 calls to Type::Tiny::Class::__ANON__[Type/Tiny/Class.pm:89], avg 3µs/call
# spent 186µs making 81 calls to Types::Standard::__ANON__[Types/Standard.pm:523], avg 2µs/call
# spent 175µs making 2 calls to Types::Standard::__ANON__[Types/Standard.pm:921], avg 88µs/call
# spent 142µs making 76 calls to Types::Standard::__ANON__[Types/Standard.pm:438], avg 2µs/call
# spent 134µs making 38 calls to Types::Standard::__ANON__[Types/Standard.pm:501], avg 4µs/call
# spent 96µs making 2 calls to Types::Standard::__ANON__[Types/Standard.pm:945], avg 48µs/call
# spent 84µs making 38 calls to Types::Standard::__ANON__[Types/Standard.pm:277], avg 2µs/call
# spent 62µs making 23 calls to Types::Standard::__ANON__[Types/Standard.pm:362], avg 3µs/call
# spent 60µs making 2 calls to Types::Standard::__ANON__[Types/Standard.pm:328], avg 30µs/call
# spent 47µs making 4 calls to Type::Tiny::Duck::__ANON__[Type/Tiny/Duck.pm:104], avg 12µs/call
# spent 41µs making 26 calls to Types::Standard::__ANON__[Types/Standard.pm:241], avg 2µs/call
# spent 39µs making 3 calls to Types::Standard::__ANON__[Types/Standard.pm:295], avg 13µs/call
# spent 34µs making 14 calls to Types::Standard::__ANON__[Types/Standard.pm:229], avg 2µs/call
# spent 24µs making 2 calls to Types::Standard::__ANON__[Types/Standard.pm:488], avg 12µs/call
# spent 23µs making 4 calls to Type::Tiny::Duck::inlined, avg 6µs/call
# spent 18µs making 5 calls to Types::Standard::__ANON__[Types/Standard.pm:566], avg 4µs/call
# spent 17µs making 2 calls to Types::Standard::__ANON__[Types/Standard.pm:851], avg 8µs/call
# spent 14µs making 2 calls to Types::Standard::__ANON__[Types/Standard.pm:456], avg 7µs/call
# spent 13µs making 4 calls to Types::Standard::__ANON__[Types/Standard.pm:348], avg 3µs/call
# spent 13µs making 7 calls to Types::Standard::__ANON__[Types/Standard.pm:384], avg 2µs/call
# spent 8µs making 5 calls to Types::Standard::__ANON__[Types/Standard.pm:251], avg 2µs/call
# spent 6µs making 1 call to Types::TypeTiny::__ANON__[Types/TypeTiny.pm:174]
# spent 5µs making 4 calls to Types::Standard::__ANON__[Types/Standard.pm:264], avg 1µs/call
# spent 3µs making 2 calls to Types::Standard::__ANON__[Types/Standard.pm:470], avg 2µs/call
# spent 3µs making 2 calls to Types::Standard::__ANON__[Types/Standard.pm:545], avg 2µs/call
# spent 3µs making 1 call to Types::TypeTiny::__ANON__[Types/TypeTiny.pm:413]
# spent 2µs making 2 calls to Types::Standard::__ANON__[Types/Standard.pm:375], avg 1µs/call |
| 896 | 592 | 225µs | if ( @r and not defined $r[0] ) { | ||
| 897 | 32 | 32µs | 32 | 15µs | _croak 'Inlining type constraint check for "%s" returned undef!', $self # spent 15µs making 32 calls to Type::Tiny::has_parent, avg 469ns/call |
| 898 | unless $self->has_parent; | ||||
| 899 | 32 | 116µs | 64 | 37µs | $r[0] = $self->parent->inline_check( @_ ); # spent 37µs making 32 calls to Type::Tiny::parent, avg 1µs/call
# spent 1.47ms making 32 calls to Type::Tiny::inline_check, avg 46µs/call, recursion: max depth 4, sum of overlapping time 1.47ms |
| 900 | } | ||||
| 901 | my $r = join " && " => map { | ||||
| 902 | 1216 | 4.16ms | 1012 | 1.03ms | /[;{}]/ && !/\Ado \{.+\}\z/ # spent 1.03ms making 1012 calls to Type::Tiny::CORE:match, avg 1µs/call |
| 903 | ? "do { $SafePackage $_ }" | ||||
| 904 | : "($_)" | ||||
| 905 | } @r; | ||||
| 906 | 592 | 1.60ms | return @r == 1 ? $r : "($r)"; | ||
| 907 | } #/ sub inline_check | ||||
| 908 | |||||
| 909 | # spent 58.6ms (6.40+52.2) within Type::Tiny::inline_assert which was called 137 times, avg 428µs/call:
# 73 times (2.72ms+26.9ms) by MooX::TypeTiny::Role::GenerateAccessor::__ANON__[/Users/ether/.perlbrew/libs/36.0@std/lib/perl5/MooX/TypeTiny/Role/GenerateAccessor.pm:33] at line 23 of MooX/TypeTiny/Role/GenerateAccessor.pm, avg 406µs/call
# 37 times (2.95ms+4.29ms) by Type::Tiny::_overload_coderef at line 215, avg 196µs/call
# 27 times (730µs+21.0ms) by Type::Tiny::_overload_coderef at line 203, avg 805µs/call | ||||
| 910 | 137 | 525µs | require B; | ||
| 911 | 137 | 47µs | my $self = shift; | ||
| 912 | 137 | 285µs | my ( $varname, $typevarname, %extras ) = @_; | ||
| 913 | |||||
| 914 | 137 | 19µs | my $inline_check; | ||
| 915 | 137 | 541µs | 274 | 48.7ms | if ( $self->can_be_inlined ) { # spent 46.5ms making 126 calls to Type::Tiny::inline_check, avg 369µs/call
# spent 1.88ms making 126 calls to Type::Tiny::can_be_inlined, avg 15µs/call
# spent 128µs making 2 calls to Type::Tiny::Union::inline_check, avg 64µs/call
# spent 119µs making 9 calls to Type::Tiny::Enum::inline_check, avg 13µs/call
# spent 39µs making 2 calls to Type::Tiny::Union::can_be_inlined, avg 20µs/call
# spent 8µs making 9 calls to Type::Tiny::Enum::can_be_inlined, avg 889ns/call |
| 916 | $inline_check = sprintf( '(%s)', $self->inline_check( $varname ) ); | ||||
| 917 | } | ||||
| 918 | elsif ( $typevarname ) { | ||||
| 919 | $inline_check = sprintf( '%s->check(%s)', $typevarname, $varname ); | ||||
| 920 | } | ||||
| 921 | else { | ||||
| 922 | _croak 'Cannot inline type constraint check for "%s"', $self; | ||||
| 923 | } | ||||
| 924 | |||||
| 925 | 137 | 112µs | my $do_wrapper = !delete $extras{no_wrapper}; | ||
| 926 | |||||
| 927 | 137 | 28µs | my $inline_throw; | ||
| 928 | 137 | 203µs | if ( $typevarname ) { | ||
| 929 | $inline_throw = sprintf( | ||||
| 930 | 'Type::Tiny::_failed_check(%s, %s, %s, %s)', | ||||
| 931 | $typevarname, | ||||
| 932 | B::perlstring( "$self" ), | ||||
| 933 | $varname, | ||||
| 934 | join( | ||||
| 935 | 73 | 2.17ms | 803 | 1.41ms | ',', map +( B::perlstring( $_ ) => B::perlstring( $extras{$_} ) ), # spent 685µs making 657 calls to B::perlstring, avg 1µs/call
# spent 612µs making 73 calls to Type::Tiny::__ANON__[Type/Tiny.pm:100], avg 8µs/call
# spent 114µs making 73 calls to Type::Tiny::CORE:sort, avg 2µs/call |
| 936 | sort keys %extras | ||||
| 937 | ), | ||||
| 938 | ); | ||||
| 939 | } #/ if ( $typevarname ) | ||||
| 940 | else { | ||||
| 941 | $inline_throw = sprintf( | ||||
| 942 | 'Type::Tiny::_failed_check(%s, %s, %s, %s)', | ||||
| 943 | $self->{uniq}, | ||||
| 944 | B::perlstring( "$self" ), | ||||
| 945 | $varname, | ||||
| 946 | join( | ||||
| 947 | 64 | 855µs | 192 | 894µs | ',', map +( B::perlstring( $_ ) => B::perlstring( $extras{$_} ) ), # spent 643µs making 64 calls to Type::Tiny::__ANON__[Type/Tiny.pm:100], avg 10µs/call
# spent 218µs making 64 calls to B::perlstring, avg 3µs/call
# spent 33µs making 64 calls to Type::Tiny::CORE:sort, avg 516ns/call |
| 948 | sort keys %extras | ||||
| 949 | ), | ||||
| 950 | ); | ||||
| 951 | } #/ else [ if ( $typevarname ) ] | ||||
| 952 | |||||
| 953 | 137 | 693µs | $do_wrapper | ||
| 954 | ? qq[do { no warnings "void"; $SafePackage $inline_check or $inline_throw; $varname };] | ||||
| 955 | : qq[ no warnings "void"; $SafePackage $inline_check or $inline_throw; $varname ]; | ||||
| 956 | } #/ sub inline_assert | ||||
| 957 | |||||
| 958 | sub _failed_check { | ||||
| 959 | require Error::TypeTiny::Assertion; | ||||
| 960 | |||||
| 961 | my ( $self, $name, $value, %attrs ) = @_; | ||||
| 962 | $self = $ALL_TYPES{$self} if defined $self && !ref $self; | ||||
| 963 | |||||
| 964 | my $exception_class = | ||||
| 965 | delete( $attrs{exception_class} ) || "Error::TypeTiny::Assertion"; | ||||
| 966 | my $callback = delete( $attrs{on_die} ); | ||||
| 967 | |||||
| 968 | if ( $self ) { | ||||
| 969 | return $exception_class->throw_cb( | ||||
| 970 | $callback, | ||||
| 971 | message => $self->get_message( $value ), | ||||
| 972 | type => $self, | ||||
| 973 | value => $value, | ||||
| 974 | %attrs, | ||||
| 975 | ); | ||||
| 976 | } | ||||
| 977 | else { | ||||
| 978 | return $exception_class->throw_cb( | ||||
| 979 | $callback, | ||||
| 980 | message => sprintf( '%s did not pass type constraint "%s"', _dd( $value ), $name ), | ||||
| 981 | value => $value, | ||||
| 982 | %attrs, | ||||
| 983 | ); | ||||
| 984 | } | ||||
| 985 | } #/ sub _failed_check | ||||
| 986 | |||||
| 987 | sub coerce { | ||||
| 988 | my $self = shift; | ||||
| 989 | $self->_assert_coercion->coerce( @_ ); | ||||
| 990 | } | ||||
| 991 | |||||
| 992 | sub assert_coerce { | ||||
| 993 | my $self = shift; | ||||
| 994 | $self->_assert_coercion->assert_coerce( @_ ); | ||||
| 995 | } | ||||
| 996 | |||||
| 997 | # spent 643µs (451+192) within Type::Tiny::is_parameterizable which was called 106 times, avg 6µs/call:
# 69 times (279µs+99µs) by Type::Tiny::parameterize at line 1026, avg 5µs/call
# 37 times (172µs+93µs) by Eval::TypeTiny::type_to_coderef at line 149 of Eval/TypeTiny.pm, avg 7µs/call | ||||
| 998 | 106 | 400µs | 106 | 192µs | shift->has_constraint_generator; # spent 192µs making 106 calls to Type::Tiny::has_constraint_generator, avg 2µs/call |
| 999 | } | ||||
| 1000 | |||||
| 1001 | # spent 10µs (6+4) within Type::Tiny::is_parameterized which was called 3 times, avg 3µs/call:
# 3 times (6µs+4µs) by Types::Standard::Dict::__inline_generator at line 103 of Types/Standard/Dict.pm, avg 3µs/call | ||||
| 1002 | 3 | 7µs | 3 | 4µs | shift->has_parameters; # spent 4µs making 3 calls to Type::Tiny::has_parameters, avg 1µs/call |
| 1003 | } | ||||
| 1004 | |||||
| 1005 | { | ||||
| 1006 | 1 | 0s | my %seen; | ||
| 1007 | |||||
| 1008 | # spent 4.22ms (1.16+3.06) within Type::Tiny::____make_key which was called 69 times, avg 61µs/call:
# 69 times (1.16ms+3.06ms) by Type::Tiny::parameterize at line 1036, avg 61µs/call | ||||
| 1009 | #<<< | ||||
| 1010 | join ',', map { | ||||
| 1011 | 69 | 300µs | Types::TypeTiny::is_TypeTiny( $_ ) ? sprintf( '$Type::Tiny::ALL_TYPES{%s}', defined( $_->{uniq} ) ? $_->{uniq} : '____CANNOT_KEY____' ) : | ||
| 1012 | ref() eq 'ARRAY' ? do { $seen{$_}++ ? '____CANNOT_KEY____' : sprintf( '[%s]', ____make_key( @$_ ) ) } : | ||||
| 1013 | ref() eq 'HASH' ? do { $seen{$_}++ ? '____CANNOT_KEY____' : sprintf( '{%s}', ____make_key( do { my %h = %$_; map +( $_, $h{$_} ), sort keys %h; } ) ) } : | ||||
| 1014 | ref() eq 'SCALAR' || ref() eq 'REF' ? do { $seen{$_}++ ? '____CANNOT_KEY____' : sprintf( '\\(%s)', ____make_key( $$_ ) ) } : | ||||
| 1015 | !defined() ? 'undef' : | ||||
| 1016 | 388 | 881µs | 308 | 3.06ms | !ref() ? do { require B; B::perlstring( $_ ) } : # spent 2.96ms making 228 calls to Types::TypeTiny::is_TypeTiny, avg 13µs/call
# spent 103µs making 80 calls to B::perlstring, avg 1µs/call |
| 1017 | '____CANNOT_KEY____'; | ||||
| 1018 | } @_; | ||||
| 1019 | #>>> | ||||
| 1020 | } #/ sub ____make_key | ||||
| 1021 | 1 | 1µs | my %param_cache; | ||
| 1022 | |||||
| 1023 | # spent 76.8ms (2.86+73.9) within Type::Tiny::parameterize which was called 69 times, avg 1.11ms/call:
# 69 times (2.86ms+73.9ms) by Types::Standard::ArrayRef or Types::Standard::Dict or Types::Standard::Enum or Types::Standard::HasMethods or Types::Standard::HashRef or Types::Standard::InstanceOf or Types::Standard::Map or Types::Standard::Optional or Types::Standard::Slurpy or Types::Standard::Tuple at line 11 of (eval 88)[Eval/TypeTiny.pm:8], avg 1.11ms/call | ||||
| 1024 | 69 | 24µs | my $self = shift; | ||
| 1025 | |||||
| 1026 | 69 | 241µs | 69 | 378µs | $self->is_parameterizable # spent 378µs making 69 calls to Type::Tiny::is_parameterizable, avg 5µs/call |
| 1027 | or @_ | ||||
| 1028 | ? _croak( "Type '%s' does not accept parameters", "$self" ) | ||||
| 1029 | : return ( $self ); | ||||
| 1030 | |||||
| 1031 | 69 | 261µs | 159 | 416µs | @_ = map Types::TypeTiny::to_TypeTiny( $_ ), @_; # spent 416µs making 159 calls to Types::TypeTiny::to_TypeTiny, avg 3µs/call |
| 1032 | |||||
| 1033 | # Generate a key for caching parameterized type constraints, | ||||
| 1034 | # but only if all the parameters are strings or type constraints. | ||||
| 1035 | 69 | 38µs | %seen = (); | ||
| 1036 | 69 | 122µs | 69 | 4.22ms | my $key = $self->____make_key( @_ ); # spent 4.22ms making 69 calls to Type::Tiny::____make_key, avg 61µs/call |
| 1037 | 69 | 187µs | 69 | 82µs | undef( $key ) if $key =~ /____CANNOT_KEY____/; # spent 82µs making 69 calls to Type::Tiny::CORE:match, avg 1µs/call |
| 1038 | 69 | 143µs | return $param_cache{$key} if defined $key && defined $param_cache{$key}; | ||
| 1039 | |||||
| 1040 | 34 | 16µs | local $Type::Tiny::parameterize_type = $self; | ||
| 1041 | 34 | 9µs | local $_ = $_[0]; | ||
| 1042 | 34 | 7µs | my $P; | ||
| 1043 | |||||
| 1044 | 34 | 241µs | 78 | 62.0ms | my ( $constraint, $compiled ) = $self->constraint_generator->( @_ ); # spent 15.5ms making 10 calls to Types::Standard::__ANON__[Types/Standard.pm:190], avg 1.55ms/call
# spent 13.4ms making 4 calls to Types::Standard::Dict::__constraint_generator, avg 3.34ms/call
# spent 11.0ms making 8 calls to Types::Standard::HashRef::__constraint_generator, avg 1.37ms/call
# spent 5.00ms making 2 calls to Types::Standard::Tuple::__constraint_generator, avg 2.50ms/call
# spent 4.26ms making 7 calls to Types::Standard::__ANON__[Types/Standard.pm:987], avg 608µs/call
# spent 3.99ms making 4 calls to Types::Standard::ArrayRef::__constraint_generator, avg 997µs/call
# spent 3.40ms making 1 call to Types::Standard::Map::__constraint_generator
# spent 2.84ms making 4 calls to Types::Standard::__ANON__[Types/Standard.pm:1059], avg 711µs/call
# spent 2.29ms making 1 call to Types::Standard::__ANON__[Types/Standard.pm:1033]
# spent 314µs making 2 calls to Types::Standard::__ANON__[Types/Standard.pm:737], avg 157µs/call
# spent 63µs making 1 call to Types::Standard::__ANON__[Types/Standard.pm:678]
# spent 53µs making 34 calls to Type::Tiny::constraint_generator, avg 2µs/call |
| 1045 | |||||
| 1046 | 34 | 67µs | 34 | 513µs | if ( Types::TypeTiny::is_TypeTiny( $constraint ) ) { # spent 513µs making 34 calls to Types::TypeTiny::is_TypeTiny, avg 15µs/call |
| 1047 | $P = $constraint; | ||||
| 1048 | } | ||||
| 1049 | else { | ||||
| 1050 | 20 | 140µs | 40 | 1.85ms | my %options = ( # spent 973µs making 4 calls to Types::Standard::__ANON__[Types/Standard.pm:826], avg 243µs/call
# spent 755µs making 14 calls to Type::Tiny::__ANON__[Type/Tiny.pm:524], avg 54µs/call
# spent 62µs making 2 calls to Types::Standard::__ANON__[Types/Standard.pm:786], avg 31µs/call
# spent 59µs making 20 calls to Type::Tiny::name_generator, avg 3µs/call |
| 1051 | constraint => $constraint, | ||||
| 1052 | display_name => $self->name_generator->( $self, @_ ), | ||||
| 1053 | parameters => [@_], | ||||
| 1054 | ); | ||||
| 1055 | 20 | 7µs | $options{compiled_type_constraint} = $compiled | ||
| 1056 | if $compiled; | ||||
| 1057 | 20 | 100µs | 60 | 9.09ms | $options{inlined} = $self->inline_generator->( @_ ) # spent 6.39ms making 4 calls to Types::Standard::Dict::__inline_generator, avg 1.60ms/call
# spent 2.19ms making 2 calls to Types::Standard::Tuple::__inline_generator, avg 1.09ms/call
# spent 229µs making 8 calls to Types::Standard::HashRef::__inline_generator, avg 29µs/call
# spent 139µs making 4 calls to Types::Standard::ArrayRef::__inline_generator, avg 35µs/call
# spent 64µs making 1 call to Types::Standard::Map::__inline_generator
# spent 46µs making 20 calls to Type::Tiny::inline_generator, avg 2µs/call
# spent 22µs making 20 calls to Type::Tiny::has_inline_generator, avg 1µs/call
# spent 20µs making 1 call to Types::Standard::__ANON__[Types/Standard.pm:686] |
| 1058 | if $self->has_inline_generator; | ||||
| 1059 | $options{type_default} = $self->{type_default_generator}->( @_ ) | ||||
| 1060 | 20 | 38µs | 14 | 178µs | if exists $self->{type_default_generator}; # undocumented # spent 76µs making 1 call to Types::Standard::__ANON__[Types/Standard.pm:661]
# spent 63µs making 8 calls to Types::Standard::__ANON__[Types/Standard.pm:532], avg 8µs/call
# spent 33µs making 4 calls to Types::Standard::__ANON__[Types/Standard.pm:510], avg 8µs/call
# spent 6µs making 1 call to Types::Standard::__ANON__[Types/Standard.pm:704] |
| 1061 | exists $options{$_} && !defined $options{$_} && delete $options{$_} | ||||
| 1062 | 20 | 94µs | for keys %options; | ||
| 1063 | |||||
| 1064 | 20 | 77µs | 20 | 1.46ms | $P = $self->create_child_type( %options ); # spent 1.46ms making 20 calls to Type::Tiny::create_child_type, avg 73µs/call |
| 1065 | |||||
| 1066 | 20 | 56µs | 20 | 28µs | if ( $self->has_coercion_generator ) { # spent 28µs making 20 calls to Type::Tiny::has_coercion_generator, avg 1µs/call |
| 1067 | 20 | 24µs | my @args = @_; | ||
| 1068 | # spent 1.36ms (160µs+1.20) within Type::Tiny::__ANON__[/Users/ether/.perlbrew/libs/36.0@std/lib/perl5/Type/Tiny.pm:1073] which was called 3 times, avg 454µs/call:
# 3 times (160µs+1.20ms) by Type::Tiny::_build_coercion at line 504, avg 454µs/call | ||||
| 1069 | 3 | 1µs | my $coercion = shift; | ||
| 1070 | 3 | 16µs | 6 | 1.20ms | my $built = $self->coercion_generator->( $self, $P, @args ); # spent 714µs making 2 calls to Types::Standard::HashRef::__coercion_generator, avg 357µs/call
# spent 477µs making 1 call to Types::Standard::Dict::__coercion_generator
# spent 5µs making 3 calls to Type::Tiny::coercion_generator, avg 2µs/call |
| 1071 | 3 | 0s | $coercion->add_type_coercions( @{ $built->type_coercion_map } ) if $built; | ||
| 1072 | 3 | 10µs | 3 | 5µs | $coercion->freeze; # spent 5µs making 3 calls to Type::Coercion::freeze, avg 2µs/call |
| 1073 | 20 | 55µs | }; | ||
| 1074 | } | ||||
| 1075 | } #/ else [ if ( Types::TypeTiny::is_TypeTiny...)] | ||||
| 1076 | |||||
| 1077 | 34 | 20µs | if ( defined $key ) { | ||
| 1078 | 34 | 38µs | $param_cache{$key} = $P; | ||
| 1079 | 34 | 80µs | 34 | 19µs | Scalar::Util::weaken( $param_cache{$key} ); # spent 19µs making 34 calls to Scalar::Util::weaken, avg 559ns/call |
| 1080 | } | ||||
| 1081 | |||||
| 1082 | 34 | 116µs | 62 | 9.17ms | $P->coercion->freeze unless $self->has_coercion_generator; # spent 9.12ms making 14 calls to Type::Tiny::coercion, avg 652µs/call
# spent 28µs making 34 calls to Type::Tiny::has_coercion_generator, avg 824ns/call
# spent 24µs making 14 calls to Type::Coercion::freeze, avg 2µs/call |
| 1083 | |||||
| 1084 | 34 | 148µs | return $P; | ||
| 1085 | } #/ sub parameterize | ||||
| 1086 | } | ||||
| 1087 | |||||
| 1088 | 1 | 0s | # spent 29µs within Type::Tiny::child_type_class which was called 27 times, avg 1µs/call:
# 27 times (29µs+0s) by Type::Tiny::create_child_type at line 1096, avg 1µs/call | ||
| 1089 | 27 | 74µs | __PACKAGE__; | ||
| 1090 | } | ||||
| 1091 | |||||
| 1092 | # spent 3.01ms (332µs+2.68) within Type::Tiny::create_child_type which was called 27 times, avg 112µs/call:
# 20 times (211µs+1.25ms) by Type::Tiny::parameterize at line 1064, avg 73µs/call
# 5 times (100µs+1.33ms) by Type::Tiny::where at line 1567, avg 287µs/call
# 2 times (21µs+98µs) by Types::Standard::__ANON__[/Users/ether/.perlbrew/libs/36.0@std/lib/perl5/Types/Standard.pm:737] at line 735 of Types/Standard.pm, avg 60µs/call | ||||
| 1093 | 27 | 14µs | my $self = shift; | ||
| 1094 | 27 | 6µs | my %moreopts; | ||
| 1095 | 27 | 50µs | $moreopts{is_object} = 1 if $self->{is_object}; | ||
| 1096 | 27 | 204µs | 54 | 2.68ms | return $self->child_type_class->new( parent => $self, %moreopts, @_ ); # spent 2.65ms making 27 calls to Type::Tiny::new, avg 98µs/call
# spent 29µs making 27 calls to Type::Tiny::child_type_class, avg 1µs/call |
| 1097 | } | ||||
| 1098 | |||||
| 1099 | sub complementary_type { | ||||
| 1100 | my $self = shift; | ||||
| 1101 | my $r = ( $self->{complementary_type} ||= $self->_build_complementary_type ); | ||||
| 1102 | Scalar::Util::weaken( $self->{complementary_type} ) | ||||
| 1103 | unless Scalar::Util::isweak( $self->{complementary_type} ); | ||||
| 1104 | return $r; | ||||
| 1105 | } | ||||
| 1106 | |||||
| 1107 | sub _build_complementary_type { | ||||
| 1108 | my $self = shift; | ||||
| 1109 | my %opts = ( | ||||
| 1110 | constraint => sub { not $self->check( $_ ) }, | ||||
| 1111 | display_name => sprintf( "~%s", $self ), | ||||
| 1112 | ); | ||||
| 1113 | $opts{display_name} =~ s/^\~{2}//; | ||||
| 1114 | $opts{inlined} = sub { shift; "not(" . $self->inline_check( @_ ) . ")" } | ||||
| 1115 | if $self->can_be_inlined; | ||||
| 1116 | $opts{display_name} = $opts{name} = $self->{complement_name} | ||||
| 1117 | if $self->{complement_name}; | ||||
| 1118 | return "Type::Tiny"->new( %opts ); | ||||
| 1119 | } #/ sub _build_complementary_type | ||||
| 1120 | |||||
| 1121 | sub _instantiate_moose_type { | ||||
| 1122 | my $self = shift; | ||||
| 1123 | my %opts = @_; | ||||
| 1124 | require Moose::Meta::TypeConstraint; | ||||
| 1125 | return "Moose::Meta::TypeConstraint"->new( %opts ); | ||||
| 1126 | } | ||||
| 1127 | |||||
| 1128 | sub _build_moose_type { | ||||
| 1129 | my $self = shift; | ||||
| 1130 | |||||
| 1131 | my $r; | ||||
| 1132 | if ( $self->{_is_core} ) { | ||||
| 1133 | require Moose::Util::TypeConstraints; | ||||
| 1134 | $r = Moose::Util::TypeConstraints::find_type_constraint( $self->name ); | ||||
| 1135 | $r->{"Types::TypeTiny::to_TypeTiny"} = $self; | ||||
| 1136 | Scalar::Util::weaken( $r->{"Types::TypeTiny::to_TypeTiny"} ); | ||||
| 1137 | } | ||||
| 1138 | else { | ||||
| 1139 | # Type::Tiny is more flexible than Moose, allowing | ||||
| 1140 | # inlined to return a list. So we need to wrap the | ||||
| 1141 | # inlined coderef to make sure Moose gets a single | ||||
| 1142 | # string. | ||||
| 1143 | # | ||||
| 1144 | my $wrapped_inlined = sub { | ||||
| 1145 | shift; | ||||
| 1146 | $self->inline_check( @_ ); | ||||
| 1147 | }; | ||||
| 1148 | |||||
| 1149 | my %opts; | ||||
| 1150 | $opts{name} = $self->qualified_name if $self->has_library && !$self->is_anon; | ||||
| 1151 | $opts{parent} = $self->parent->moose_type if $self->has_parent; | ||||
| 1152 | $opts{constraint} = $self->constraint unless $self->_is_null_constraint; | ||||
| 1153 | $opts{message} = $self->message if $self->has_message; | ||||
| 1154 | $opts{inlined} = $wrapped_inlined if $self->has_inlined; | ||||
| 1155 | |||||
| 1156 | $r = $self->_instantiate_moose_type( %opts ); | ||||
| 1157 | $r->{"Types::TypeTiny::to_TypeTiny"} = $self; | ||||
| 1158 | $self->{moose_type} = $r; # prevent recursion | ||||
| 1159 | $r->coercion( $self->coercion->moose_coercion ) if $self->has_coercion; | ||||
| 1160 | } #/ else [ if ( $self->{_is_core})] | ||||
| 1161 | |||||
| 1162 | return $r; | ||||
| 1163 | } #/ sub _build_moose_type | ||||
| 1164 | |||||
| 1165 | sub _build_mouse_type { | ||||
| 1166 | my $self = shift; | ||||
| 1167 | |||||
| 1168 | my %options; | ||||
| 1169 | $options{name} = $self->qualified_name if $self->has_library && !$self->is_anon; | ||||
| 1170 | $options{parent} = $self->parent->mouse_type if $self->has_parent; | ||||
| 1171 | $options{constraint} = $self->constraint unless $self->_is_null_constraint; | ||||
| 1172 | $options{message} = $self->message if $self->has_message; | ||||
| 1173 | |||||
| 1174 | require Mouse::Meta::TypeConstraint; | ||||
| 1175 | my $r = "Mouse::Meta::TypeConstraint"->new( %options ); | ||||
| 1176 | |||||
| 1177 | $self->{mouse_type} = $r; # prevent recursion | ||||
| 1178 | $r->_add_type_coercions( | ||||
| 1179 | $self->coercion->freeze->_codelike_type_coercion_map( 'mouse_type' ) ) | ||||
| 1180 | if $self->has_coercion; | ||||
| 1181 | |||||
| 1182 | return $r; | ||||
| 1183 | } #/ sub _build_mouse_type | ||||
| 1184 | |||||
| 1185 | # spent 32.0ms (1.18+30.8) within Type::Tiny::exportables which was called 38 times, avg 841µs/call:
# 37 times (1.14ms+30.2ms) by Type::Library::add_type at line 235 of Type/Library.pm, avg 848µs/call
# once (35µs+559µs) by Type::Tiny::exportables_by_tag at line 1231 | ||||
| 1186 | 38 | 30µs | my ( $self, $base_name, $tag ) = ( shift, @_ ); # $tag is undocumented | ||
| 1187 | 38 | 75µs | 76 | 113µs | if ( not $self->is_anon ) { # spent 91µs making 38 calls to Type::Tiny::is_anon, avg 2µs/call
# spent 22µs making 38 calls to Type::Tiny::name, avg 579ns/call |
| 1188 | $base_name ||= $self->name; | ||||
| 1189 | } | ||||
| 1190 | 38 | 14µs | $tag ||= 0; | ||
| 1191 | |||||
| 1192 | 38 | 9µs | my @exportables; | ||
| 1193 | 38 | 14µs | return \@exportables if ! $base_name; | ||
| 1194 | |||||
| 1195 | 38 | 24µs | require Eval::TypeTiny; | ||
| 1196 | |||||
| 1197 | 38 | 166µs | 37 | 7.79ms | push @exportables, { # spent 7.79ms making 37 calls to Eval::TypeTiny::type_to_coderef, avg 211µs/call |
| 1198 | name => $base_name, | ||||
| 1199 | code => Eval::TypeTiny::type_to_coderef( $self ), | ||||
| 1200 | tags => [ 'types' ], | ||||
| 1201 | } if $tag eq 'types' || !$tag; | ||||
| 1202 | |||||
| 1203 | 38 | 144µs | 37 | 5.36ms | push @exportables, { # spent 5.36ms making 37 calls to Type::Tiny::compiled_check, avg 145µs/call |
| 1204 | name => sprintf( 'is_%s', $base_name ), | ||||
| 1205 | code => $self->compiled_check, | ||||
| 1206 | tags => [ 'is' ], | ||||
| 1207 | } if $tag eq 'is' || !$tag; | ||||
| 1208 | |||||
| 1209 | 38 | 194µs | 37 | 16.9ms | push @exportables, { # spent 16.9ms making 37 calls to Type::Tiny::_overload_coderef, avg 457µs/call |
| 1210 | name => sprintf( 'assert_%s', $base_name ), | ||||
| 1211 | code => $self->_overload_coderef, | ||||
| 1212 | tags => [ 'assert' ], | ||||
| 1213 | } if $tag eq 'assert' || !$tag; | ||||
| 1214 | |||||
| 1215 | push @exportables, { | ||||
| 1216 | name => sprintf( 'to_%s', $base_name ), | ||||
| 1217 | code => $self->has_coercion && $self->coercion->frozen | ||||
| 1218 | ? $self->coercion->compiled_coercion | ||||
| 1219 | : sub ($) { $self->coerce( $_[0] ) }, | ||||
| 1220 | 38 | 231µs | 42 | 622µs | tags => [ 'to' ], # spent 542µs making 1 call to Type::Coercion::compiled_coercion
# spent 74µs making 38 calls to Type::Tiny::has_coercion, avg 2µs/call
# spent 6µs making 2 calls to Type::Tiny::coercion, avg 3µs/call
# spent 0s making 1 call to Type::Coercion::frozen |
| 1221 | } if $tag eq 'to' || !$tag; | ||||
| 1222 | |||||
| 1223 | 38 | 104µs | return \@exportables; | ||
| 1224 | } | ||||
| 1225 | |||||
| 1226 | # spent 605µs (11+594) within Type::Tiny::exportables_by_tag which was called:
# once (11µs+594µs) by Type::Library::make_immutable at line 320 of Type/Library.pm | ||||
| 1227 | 1 | 1µs | my ( $self, $tag, $base_name ) = ( shift, @_ ); | ||
| 1228 | my @matched = grep { | ||||
| 1229 | 1 | 0s | my $e = $_; | ||
| 1230 | 1 | 2µs | grep $_ eq $tag, @{ $e->{tags} || [] }; | ||
| 1231 | 1 | 5µs | 1 | 594µs | } @{ $self->exportables( $base_name, $tag ) }; # spent 594µs making 1 call to Type::Tiny::exportables |
| 1232 | 1 | 3µs | return @matched if wantarray; | ||
| 1233 | _croak( 'Expected to find one exportable tagged "%s", found %d', $tag, scalar @matched ) | ||||
| 1234 | unless @matched == 1; | ||||
| 1235 | return $matched[0]; | ||||
| 1236 | } | ||||
| 1237 | |||||
| 1238 | sub _process_coercion_list { | ||||
| 1239 | my $self = shift; | ||||
| 1240 | |||||
| 1241 | my @pairs; | ||||
| 1242 | while ( @_ ) { | ||||
| 1243 | my $next = shift; | ||||
| 1244 | if ( blessed( $next ) | ||||
| 1245 | and $next->isa( 'Type::Coercion' ) | ||||
| 1246 | and $next->is_parameterized ) | ||||
| 1247 | { | ||||
| 1248 | push @pairs => ( @{ $next->_reparameterize( $self )->type_coercion_map } ); | ||||
| 1249 | } | ||||
| 1250 | elsif ( blessed( $next ) and $next->can( 'type_coercion_map' ) ) { | ||||
| 1251 | push @pairs => ( | ||||
| 1252 | @{ $next->type_coercion_map }, | ||||
| 1253 | ); | ||||
| 1254 | } | ||||
| 1255 | elsif ( ref( $next ) eq q(ARRAY) ) { | ||||
| 1256 | unshift @_, @$next; | ||||
| 1257 | } | ||||
| 1258 | else { | ||||
| 1259 | push @pairs => ( | ||||
| 1260 | Types::TypeTiny::to_TypeTiny( $next ), | ||||
| 1261 | shift, | ||||
| 1262 | ); | ||||
| 1263 | } | ||||
| 1264 | } #/ while ( @_ ) | ||||
| 1265 | |||||
| 1266 | return @pairs; | ||||
| 1267 | } #/ sub _process_coercion_list | ||||
| 1268 | |||||
| 1269 | sub plus_coercions { | ||||
| 1270 | my $self = shift; | ||||
| 1271 | my $new = $self->_clone; | ||||
| 1272 | $new->coercion->add_type_coercions( | ||||
| 1273 | $self->_process_coercion_list( @_ ), | ||||
| 1274 | @{ $self->coercion->type_coercion_map }, | ||||
| 1275 | ); | ||||
| 1276 | $new->coercion->freeze; | ||||
| 1277 | return $new; | ||||
| 1278 | } #/ sub plus_coercions | ||||
| 1279 | |||||
| 1280 | sub plus_fallback_coercions { | ||||
| 1281 | my $self = shift; | ||||
| 1282 | |||||
| 1283 | my $new = $self->_clone; | ||||
| 1284 | $new->coercion->add_type_coercions( | ||||
| 1285 | @{ $self->coercion->type_coercion_map }, | ||||
| 1286 | $self->_process_coercion_list( @_ ), | ||||
| 1287 | ); | ||||
| 1288 | $new->coercion->freeze; | ||||
| 1289 | return $new; | ||||
| 1290 | } #/ sub plus_fallback_coercions | ||||
| 1291 | |||||
| 1292 | sub minus_coercions { | ||||
| 1293 | my $self = shift; | ||||
| 1294 | |||||
| 1295 | my $new = $self->_clone; | ||||
| 1296 | my @not = grep Types::TypeTiny::is_TypeTiny( $_ ), | ||||
| 1297 | $self->_process_coercion_list( $new, @_ ); | ||||
| 1298 | |||||
| 1299 | my @keep; | ||||
| 1300 | my $c = $self->coercion->type_coercion_map; | ||||
| 1301 | for ( my $i = 0 ; $i <= $#$c ; $i += 2 ) { | ||||
| 1302 | my $keep_this = 1; | ||||
| 1303 | NOT: for my $n ( @not ) { | ||||
| 1304 | if ( $c->[$i] == $n ) { | ||||
| 1305 | $keep_this = 0; | ||||
| 1306 | last NOT; | ||||
| 1307 | } | ||||
| 1308 | } | ||||
| 1309 | |||||
| 1310 | push @keep, $c->[$i], $c->[ $i + 1 ] if $keep_this; | ||||
| 1311 | } #/ for ( my $i = 0 ; $i <=...) | ||||
| 1312 | |||||
| 1313 | $new->coercion->add_type_coercions( @keep ); | ||||
| 1314 | $new->coercion->freeze; | ||||
| 1315 | return $new; | ||||
| 1316 | } #/ sub minus_coercions | ||||
| 1317 | |||||
| 1318 | sub no_coercions { | ||||
| 1319 | my $new = shift->_clone; | ||||
| 1320 | $new->coercion->freeze; | ||||
| 1321 | $new; | ||||
| 1322 | } | ||||
| 1323 | |||||
| 1324 | sub coercibles { | ||||
| 1325 | my $self = shift; | ||||
| 1326 | $self->has_coercion ? $self->coercion->_source_type_union : $self; | ||||
| 1327 | } | ||||
| 1328 | |||||
| 1329 | # spent 9.48ms (7.73+1.75) within Type::Tiny::isa which was called 3756 times, avg 3µs/call:
# 794 times (1.63ms+348µs) by Type::Tiny::strictly_equals at line 687, avg 2µs/call
# 794 times (1.31ms+248µs) by Type::Tiny::strictly_equals at line 688, avg 2µs/call
# 703 times (1.37ms+346µs) by Type::Tiny::is_strictly_subtype_of at line 694, avg 2µs/call
# 703 times (1.23ms+238µs) by Type::Tiny::is_strictly_subtype_of at line 695, avg 2µs/call
# 236 times (667µs+168µs) by Eval::TypeTiny::Sandbox::__ANON__[(eval 57)[/Users/ether/.perlbrew/libs/36.0@std/lib/perl5/Eval/TypeTiny.pm:8]:3] at line 3 of (eval 57)[Eval/TypeTiny.pm:8], avg 4µs/call
# 191 times (518µs+135µs) by Type::Tiny::is_strictly_a_type_of at line 712, avg 3µs/call
# 191 times (398µs+73µs) by Type::Tiny::is_strictly_a_type_of at line 713, avg 2µs/call
# 73 times (313µs+89µs) by MooX::TypeTiny::Role::GenerateAccessor::__ANON__[/Users/ether/.perlbrew/libs/36.0@std/lib/perl5/MooX/TypeTiny/Role/GenerateAccessor.pm:33] at line 13 of MooX/TypeTiny/Role/GenerateAccessor.pm, avg 6µs/call
# 63 times (269µs+91µs) by Type::Tiny::new at line 255, avg 6µs/call
# 3 times (9µs+15µs) by Type::Tiny::__ANON__[/Users/ether/.perlbrew/libs/36.0@std/lib/perl5/Type/Tiny.pm:602] at line 590, avg 8µs/call
# 3 times (3µs+2µs) by Type::Tiny::__ANON__[/Users/ether/.perlbrew/libs/36.0@std/lib/perl5/Type/Tiny.pm:602] at line 591, avg 2µs/call
# 2 times (8µs+1µs) by Type::Tiny::Union::new at line 60 of Type/Tiny/Union.pm, avg 4µs/call | ||||
| 1330 | 3756 | 471µs | my $self = shift; | ||
| 1331 | |||||
| 1332 | 3756 | 597µs | if ( $INC{"Moose.pm"} | ||
| 1333 | and ref( $self ) | ||||
| 1334 | and $_[0] =~ /^(?:Class::MOP|MooseX?::Meta)::(.+)$/ ) | ||||
| 1335 | { | ||||
| 1336 | my $meta = $1; | ||||
| 1337 | |||||
| 1338 | return !!1 if $meta eq 'TypeConstraint'; | ||||
| 1339 | return $self->is_parameterized if $meta eq 'TypeConstraint::Parameterized'; | ||||
| 1340 | return $self->is_parameterizable if $meta eq 'TypeConstraint::Parameterizable'; | ||||
| 1341 | return $self->isa( 'Type::Tiny::Union' ) if $meta eq 'TypeConstraint::Union'; | ||||
| 1342 | |||||
| 1343 | my $inflate = $self->moose_type; | ||||
| 1344 | return $inflate->isa( @_ ); | ||||
| 1345 | } #/ if ( $INC{"Moose.pm"} ...) | ||||
| 1346 | |||||
| 1347 | 3756 | 433µs | if ( $INC{"Mouse.pm"} | ||
| 1348 | and ref( $self ) | ||||
| 1349 | and $_[0] eq 'Mouse::Meta::TypeConstraint' ) | ||||
| 1350 | { | ||||
| 1351 | return !!1; | ||||
| 1352 | } | ||||
| 1353 | |||||
| 1354 | 3756 | 10.9ms | 3756 | 1.75ms | $self->SUPER::isa( @_ ); # spent 1.75ms making 3756 calls to UNIVERSAL::isa, avg 467ns/call |
| 1355 | } #/ sub isa | ||||
| 1356 | |||||
| 1357 | # spent 2µs within Type::Tiny::_build_my_methods which was called 2 times, avg 1µs/call:
# 2 times (2µs+0s) by Type::Tiny::my_methods at line 452, avg 1µs/call | ||||
| 1358 | 2 | 5µs | return {}; | ||
| 1359 | } | ||||
| 1360 | |||||
| 1361 | sub _lookup_my_method { | ||||
| 1362 | 12 | 4µs | my $self = shift; | ||
| 1363 | 12 | 10µs | my ( $name ) = @_; | ||
| 1364 | |||||
| 1365 | 12 | 29µs | 18 | 28µs | if ( $self->my_methods->{$name} ) { # spent 28µs making 18 calls to Type::Tiny::my_methods, avg 2µs/call |
| 1366 | return $self->my_methods->{$name}; | ||||
| 1367 | } | ||||
| 1368 | |||||
| 1369 | 6 | 34µs | 18 | 8µs | if ( $self->has_parent ) { # spent 7µs making 6 calls to Type::Tiny::parent, avg 1µs/call
# spent 1µs making 6 calls to Type::Tiny::has_parent, avg 167ns/call
# spent 27µs making 6 calls to Type::Tiny::_lookup_my_method, avg 4µs/call, recursion: max depth 1, sum of overlapping time 27µs |
| 1370 | return $self->parent->_lookup_my_method( @_ ); | ||||
| 1371 | } | ||||
| 1372 | |||||
| 1373 | return; | ||||
| 1374 | } #/ sub _lookup_my_method | ||||
| 1375 | |||||
| 1376 | 1 | 3µs | my %object_methods = ( | ||
| 1377 | with_attribute_values => 1, stringifies_to => 1, | ||||
| 1378 | numifies_to => 1 | ||||
| 1379 | ); | ||||
| 1380 | |||||
| 1381 | # spent 487µs (380+107) within Type::Tiny::can which was called 67 times, avg 7µs/call:
# 61 times (327µs+91µs) by Type::Tiny::_overload_coderef at line 190, avg 7µs/call
# 4 times (37µs+9µs) by Type::Coercion::add_type_coercions at line 240 of Type/Coercion.pm, avg 12µs/call
# 2 times (16µs+7µs) by Type::Tiny::Union::new_by_overload at line 30 of Type/Tiny/Union.pm, avg 12µs/call | ||||
| 1382 | 67 | 13µs | my $self = shift; | ||
| 1383 | |||||
| 1384 | 67 | 44µs | return !!0 | ||
| 1385 | if $_[0] eq 'type_parameter' | ||||
| 1386 | && blessed( $_[0] ) | ||||
| 1387 | && $_[0]->has_parameters; | ||||
| 1388 | |||||
| 1389 | 67 | 287µs | 67 | 100µs | my $can = $self->SUPER::can( @_ ); # spent 100µs making 67 calls to UNIVERSAL::can, avg 1µs/call |
| 1390 | 67 | 244µs | return $can if $can; | ||
| 1391 | |||||
| 1392 | 6 | 3µs | if ( ref( $self ) ) { | ||
| 1393 | 6 | 3µs | if ( $INC{"Moose.pm"} ) { | ||
| 1394 | my $method = $self->moose_type->can( @_ ); | ||||
| 1395 | return sub { shift->moose_type->$method( @_ ) } | ||||
| 1396 | if $method; | ||||
| 1397 | } | ||||
| 1398 | 6 | 14µs | 6 | 7µs | if ( $_[0] =~ /\Amy_(.+)\z/ ) { # spent 7µs making 6 calls to Type::Tiny::CORE:match, avg 1µs/call |
| 1399 | my $method = $self->_lookup_my_method( $1 ); | ||||
| 1400 | return $method if $method; | ||||
| 1401 | } | ||||
| 1402 | 6 | 3µs | if ( $self->{is_object} && $object_methods{ $_[0] } ) { | ||
| 1403 | require Type::Tiny::ConstrainedObject; | ||||
| 1404 | return Type::Tiny::ConstrainedObject->can( $_[0] ); | ||||
| 1405 | } | ||||
| 1406 | 6 | 5µs | for my $util ( qw/ grep map sort rsort first any all assert_any assert_all / ) { | ||
| 1407 | 54 | 9µs | if ( $_[0] eq $util ) { | ||
| 1408 | $self->{'_util'}{$util} ||= eval { $self->_build_util( $util ) }; | ||||
| 1409 | return unless $self->{'_util'}{$util}; | ||||
| 1410 | return sub { my $s = shift; $s->{'_util'}{$util}( @_ ) }; | ||||
| 1411 | } | ||||
| 1412 | } | ||||
| 1413 | } #/ if ( ref( $self ) ) | ||||
| 1414 | |||||
| 1415 | 6 | 8µs | return; | ||
| 1416 | } #/ sub can | ||||
| 1417 | |||||
| 1418 | # spent 416µs (80+336) within Type::Tiny::AUTOLOAD which was called 6 times, avg 69µs/call:
# 3 times (55µs+260µs) by Types::Standard::Dict::__constraint_generator at line 44 of Types/Standard/Dict.pm, avg 105µs/call
# 3 times (25µs+76µs) by Types::Standard::Dict::__inline_generator at line 90 of Types/Standard/Dict.pm, avg 34µs/call | ||||
| 1419 | 6 | 4µs | my $self = shift; | ||
| 1420 | 6 | 47µs | 6 | 28µs | my ( $m ) = ( our $AUTOLOAD =~ /::(\w+)$/ ); # spent 28µs making 6 calls to Type::Tiny::CORE:match, avg 5µs/call |
| 1421 | 6 | 4µs | return if $m eq 'DESTROY'; | ||
| 1422 | |||||
| 1423 | 6 | 2µs | if ( ref( $self ) ) { | ||
| 1424 | 6 | 3µs | if ( $INC{"Moose.pm"} ) { | ||
| 1425 | my $method = $self->moose_type->can( $m ); | ||||
| 1426 | return $self->moose_type->$method( @_ ) if $method; | ||||
| 1427 | } | ||||
| 1428 | 6 | 14µs | 6 | 7µs | if ( $m =~ /\Amy_(.+)\z/ ) { # spent 7µs making 6 calls to Type::Tiny::CORE:match, avg 1µs/call |
| 1429 | 6 | 10µs | 6 | 143µs | my $method = $self->_lookup_my_method( $1 ); # spent 143µs making 6 calls to Type::Tiny::_lookup_my_method, avg 24µs/call |
| 1430 | 6 | 26µs | 6 | 158µs | return &$method( $self, @_ ) if $method; # spent 158µs making 6 calls to Types::Standard::Slurpy::my_unslurpy, avg 26µs/call |
| 1431 | } | ||||
| 1432 | if ( $self->{is_object} && $object_methods{$m} ) { | ||||
| 1433 | require Type::Tiny::ConstrainedObject; | ||||
| 1434 | unshift @_, $self; | ||||
| 1435 | 2 | 1.24ms | 2 | 44µs | # spent 31µs (18+13) within Type::Tiny::BEGIN@1435 which was called:
# once (18µs+13µs) by Type::Library::BEGIN@16 at line 1435 # spent 31µs making 1 call to Type::Tiny::BEGIN@1435
# spent 13µs making 1 call to strict::unimport |
| 1436 | goto \&{"Type::Tiny::ConstrainedObject::$m"}; | ||||
| 1437 | } | ||||
| 1438 | for my $util ( qw/ grep map sort rsort first any all assert_any assert_all / ) { | ||||
| 1439 | if ( $m eq $util ) { | ||||
| 1440 | return ( $self->{'_util'}{$util} ||= $self->_build_util( $util ) )->( @_ ); | ||||
| 1441 | } | ||||
| 1442 | } | ||||
| 1443 | } #/ if ( ref( $self ) ) | ||||
| 1444 | |||||
| 1445 | _croak q[Can't locate object method "%s" via package "%s"], $m, | ||||
| 1446 | ref( $self ) || $self; | ||||
| 1447 | } #/ sub AUTOLOAD | ||||
| 1448 | |||||
| 1449 | sub DOES { | ||||
| 1450 | my $self = shift; | ||||
| 1451 | |||||
| 1452 | return !!1 | ||||
| 1453 | if ref( $self ) | ||||
| 1454 | && $_[0] =~ m{^ Type::API::Constraint (?: ::Coercible | ::Inlinable )? $}x; | ||||
| 1455 | return !!1 if !ref( $self ) && $_[0] eq 'Type::API::Constraint::Constructor'; | ||||
| 1456 | |||||
| 1457 | "UNIVERSAL"->can( "DOES" ) ? $self->SUPER::DOES( @_ ) : $self->isa( @_ ); | ||||
| 1458 | } #/ sub DOES | ||||
| 1459 | |||||
| 1460 | sub _has_xsub { | ||||
| 1461 | require B; | ||||
| 1462 | !!B::svref_2object( shift->compiled_check )->XSUB; | ||||
| 1463 | } | ||||
| 1464 | |||||
| 1465 | sub _build_util { | ||||
| 1466 | my ( $self, $func ) = @_; | ||||
| 1467 | Scalar::Util::weaken( my $type = $self ); | ||||
| 1468 | |||||
| 1469 | if ( $func eq 'grep' | ||||
| 1470 | || $func eq 'first' | ||||
| 1471 | || $func eq 'any' | ||||
| 1472 | || $func eq 'all' | ||||
| 1473 | || $func eq 'assert_any' | ||||
| 1474 | || $func eq 'assert_all' ) | ||||
| 1475 | { | ||||
| 1476 | my ( $inline, $compiled ); | ||||
| 1477 | |||||
| 1478 | if ( $self->can_be_inlined ) { | ||||
| 1479 | $inline = $self->inline_check( '$_' ); | ||||
| 1480 | } | ||||
| 1481 | else { | ||||
| 1482 | $compiled = $self->compiled_check; | ||||
| 1483 | $inline = '$compiled->($_)'; | ||||
| 1484 | } | ||||
| 1485 | |||||
| 1486 | if ( $func eq 'grep' ) { | ||||
| 1487 | return eval "sub { grep { $inline } \@_ }"; | ||||
| 1488 | } | ||||
| 1489 | elsif ( $func eq 'first' ) { | ||||
| 1490 | return eval "sub { for (\@_) { return \$_ if ($inline) }; undef; }"; | ||||
| 1491 | } | ||||
| 1492 | elsif ( $func eq 'any' ) { | ||||
| 1493 | return eval "sub { for (\@_) { return !!1 if ($inline) }; !!0; }"; | ||||
| 1494 | } | ||||
| 1495 | elsif ( $func eq 'assert_any' ) { | ||||
| 1496 | my $qname = B::perlstring( $self->name ); | ||||
| 1497 | return | ||||
| 1498 | eval | ||||
| 1499 | "sub { for (\@_) { return \@_ if ($inline) }; Type::Tiny::_failed_check(\$type, $qname, \@_ ? \$_[-1] : undef); }"; | ||||
| 1500 | } | ||||
| 1501 | elsif ( $func eq 'all' ) { | ||||
| 1502 | return eval "sub { for (\@_) { return !!0 unless ($inline) }; !!1; }"; | ||||
| 1503 | } | ||||
| 1504 | elsif ( $func eq 'assert_all' ) { | ||||
| 1505 | my $qname = B::perlstring( $self->name ); | ||||
| 1506 | return | ||||
| 1507 | eval | ||||
| 1508 | "sub { my \$idx = 0; for (\@_) { Type::Tiny::_failed_check(\$type, $qname, \$_, varname => sprintf('\$_[%d]', \$idx)) unless ($inline); ++\$idx }; \@_; }"; | ||||
| 1509 | } | ||||
| 1510 | } #/ if ( $func eq 'grep' ||...) | ||||
| 1511 | |||||
| 1512 | if ( $func eq 'map' ) { | ||||
| 1513 | my ( $inline, $compiled ); | ||||
| 1514 | my $c = $self->_assert_coercion; | ||||
| 1515 | |||||
| 1516 | if ( $c->can_be_inlined ) { | ||||
| 1517 | $inline = $c->inline_coercion( '$_' ); | ||||
| 1518 | } | ||||
| 1519 | else { | ||||
| 1520 | $compiled = $c->compiled_coercion; | ||||
| 1521 | $inline = '$compiled->($_)'; | ||||
| 1522 | } | ||||
| 1523 | |||||
| 1524 | return eval "sub { map { $inline } \@_ }"; | ||||
| 1525 | } #/ if ( $func eq 'map' ) | ||||
| 1526 | |||||
| 1527 | if ( $func eq 'sort' || $func eq 'rsort' ) { | ||||
| 1528 | my ( $inline, $compiled ); | ||||
| 1529 | |||||
| 1530 | my $ptype = $self->find_parent( sub { $_->has_sorter } ); | ||||
| 1531 | _croak "No sorter for this type constraint" unless $ptype; | ||||
| 1532 | |||||
| 1533 | my $sorter = $ptype->sorter; | ||||
| 1534 | |||||
| 1535 | # Schwarzian transformation | ||||
| 1536 | if ( ref( $sorter ) eq 'ARRAY' ) { | ||||
| 1537 | my $sort_key; | ||||
| 1538 | ( $sorter, $sort_key ) = @$sorter; | ||||
| 1539 | |||||
| 1540 | if ( $func eq 'sort' ) { | ||||
| 1541 | return | ||||
| 1542 | eval | ||||
| 1543 | "our (\$a, \$b); sub { map \$_->[0], sort { \$sorter->(\$a->[1],\$b->[1]) } map [\$_,\$sort_key->(\$_)], \@_ }"; | ||||
| 1544 | } | ||||
| 1545 | elsif ( $func eq 'rsort' ) { | ||||
| 1546 | return | ||||
| 1547 | eval | ||||
| 1548 | "our (\$a, \$b); sub { map \$_->[0], sort { \$sorter->(\$b->[1],\$a->[1]) } map [\$_,\$sort_key->(\$_)], \@_ }"; | ||||
| 1549 | } | ||||
| 1550 | } #/ if ( ref( $sorter ) eq...) | ||||
| 1551 | |||||
| 1552 | # Simple sort | ||||
| 1553 | else { | ||||
| 1554 | if ( $func eq 'sort' ) { | ||||
| 1555 | return eval "our (\$a, \$b); sub { sort { \$sorter->(\$a,\$b) } \@_ }"; | ||||
| 1556 | } | ||||
| 1557 | elsif ( $func eq 'rsort' ) { | ||||
| 1558 | return eval "our (\$a, \$b); sub { sort { \$sorter->(\$b,\$a) } \@_ }"; | ||||
| 1559 | } | ||||
| 1560 | } | ||||
| 1561 | } #/ if ( $func eq 'sort' ||...) | ||||
| 1562 | |||||
| 1563 | die "Unknown function: $func"; | ||||
| 1564 | } #/ sub _build_util | ||||
| 1565 | |||||
| 1566 | sub of { shift->parameterize( @_ ) } | ||||
| 1567 | 5 | 36µs | 5 | 1.43ms | # spent 1.47ms (34µs+1.43) within Type::Tiny::where which was called 5 times, avg 293µs/call:
# once (8µs+395µs) by JSON::Schema::Modern::add_vocabulary at line 707 of JSON/Schema/Modern.pm
# once (5µs+299µs) by OpenAPI::Modern::BEGIN@26 at line 923 of JSON/Schema/Modern.pm
# once (7µs+280µs) by JSON::Schema::Modern::BEGIN@35 at line 79 of JSON/Schema/Modern/Document.pm
# once (8µs+270µs) by JSON::Schema::Modern::BEGIN@35 at line 40 of JSON/Schema/Modern/Document.pm
# once (6µs+189µs) by OpenAPI::Modern::BEGIN@26 at line 637 of JSON/Schema/Modern.pm # spent 1.43ms making 5 calls to Type::Tiny::create_child_type, avg 287µs/call |
| 1568 | |||||
| 1569 | # fill out Moose-compatible API | ||||
| 1570 | sub inline_environment { +{} } | ||||
| 1571 | sub _inline_check { shift->inline_check( @_ ) } | ||||
| 1572 | sub _compiled_type_constraint { shift->compiled_check( @_ ) } | ||||
| 1573 | sub meta { _croak( "Not really a Moose::Meta::TypeConstraint. Sorry!" ) } | ||||
| 1574 | sub compile_type_constraint { shift->compiled_check } | ||||
| 1575 | sub _actually_compile_type_constraint { shift->_build_compiled_check } | ||||
| 1576 | sub hand_optimized_type_constraint { shift->{hand_optimized_type_constraint} } | ||||
| 1577 | |||||
| 1578 | sub has_hand_optimized_type_constraint { | ||||
| 1579 | exists( shift->{hand_optimized_type_constraint} ); | ||||
| 1580 | } | ||||
| 1581 | 2 | 34µs | 2 | 14µs | # spent 34µs (20+14) within Type::Tiny::type_parameter which was called 2 times, avg 17µs/call:
# 2 times (20µs+14µs) by Types::Standard::Slurpy::my_unslurpy at line 751 of Types/Standard.pm, avg 17µs/call # spent 14µs making 2 calls to Type::Tiny::parameters, avg 7µs/call |
| 1582 | |||||
| 1583 | sub parameterized_from { | ||||
| 1584 | $_[0]->is_parameterized ? shift->parent : _croak( "Not a parameterized type" ); | ||||
| 1585 | } | ||||
| 1586 | sub has_parameterized_from { $_[0]->is_parameterized } | ||||
| 1587 | |||||
| 1588 | # some stuff for Mouse-compatible API | ||||
| 1589 | sub __is_parameterized { shift->is_parameterized( @_ ) } | ||||
| 1590 | sub _add_type_coercions { shift->coercion->add_type_coercions( @_ ) } | ||||
| 1591 | sub _as_string { shift->qualified_name( @_ ) } | ||||
| 1592 | sub _compiled_type_coercion { shift->coercion->compiled_coercion( @_ ) } | ||||
| 1593 | sub _identity { Scalar::Util::refaddr( shift ) } | ||||
| 1594 | |||||
| 1595 | sub _unite { | ||||
| 1596 | require Type::Tiny::Union; | ||||
| 1597 | "Type::Tiny::Union"->new( type_constraints => \@_ ); | ||||
| 1598 | } | ||||
| 1599 | |||||
| 1600 | # Hooks for Type::Tie | ||||
| 1601 | sub TIESCALAR { | ||||
| 1602 | require Type::Tie; | ||||
| 1603 | unshift @_, 'Type::Tie::SCALAR'; | ||||
| 1604 | goto \&Type::Tie::SCALAR::TIESCALAR; | ||||
| 1605 | } | ||||
| 1606 | |||||
| 1607 | sub TIEARRAY { | ||||
| 1608 | require Type::Tie; | ||||
| 1609 | unshift @_, 'Type::Tie::ARRAY'; | ||||
| 1610 | goto \&Type::Tie::ARRAY::TIEARRAY; | ||||
| 1611 | } | ||||
| 1612 | |||||
| 1613 | sub TIEHASH { | ||||
| 1614 | require Type::Tie; | ||||
| 1615 | unshift @_, 'Type::Tie::HASH'; | ||||
| 1616 | goto \&Type::Tie::HASH::TIEHASH; | ||||
| 1617 | } | ||||
| 1618 | |||||
| 1619 | 1 | 14µs | 1; | ||
| 1620 | |||||
| 1621 | __END__ | ||||
# spent 2.19ms within Type::Tiny::CORE:match which was called 2032 times, avg 1µs/call:
# 1012 times (1.03ms+0s) by Type::Tiny::inline_check at line 902, avg 1µs/call
# 372 times (310µs+0s) by Type::Tiny::__ANON__[/Users/ether/.perlbrew/libs/36.0@std/lib/perl5/Type/Tiny.pm:100] at line 97, avg 833ns/call
# 180 times (181µs+0s) by Type::Tiny::__ANON__[(eval 428)[/Users/ether/.perlbrew/libs/36.0@std/lib/perl5/Sub/Quote.pm:3]:16] at line 16 of (eval 428)[Sub/Quote.pm:3], avg 1µs/call
# 168 times (125µs+0s) by Type::Tiny::__ANON__[(eval 430)[/Users/ether/.perlbrew/libs/36.0@std/lib/perl5/Sub/Quote.pm:3]:16] at line 16 of (eval 430)[Sub/Quote.pm:3], avg 744ns/call
# 70 times (92µs+0s) by JSON::Schema::Modern::Document::_assert__path_to_resource at line 24 of (eval 299)[Sub/Quote.pm:3], avg 1µs/call
# 69 times (82µs+0s) by Type::Tiny::parameterize at line 1037, avg 1µs/call
# 63 times (138µs+0s) by Type::Tiny::new at line 251, avg 2µs/call
# 39 times (156µs+0s) by Type::Tiny::new at line 291, avg 4µs/call
# 20 times (9µs+0s) by Type::Tiny::__ANON__[(eval 423)[/Users/ether/.perlbrew/libs/36.0@std/lib/perl5/Sub/Quote.pm:3]:16] at line 16 of (eval 423)[Sub/Quote.pm:3], avg 450ns/call
# 14 times (6µs+0s) by JSON::Schema::Modern::_assert__vocabulary_classes at line 24 of (eval 355)[Sub/Quote.pm:3], avg 429ns/call
# 6 times (28µs+0s) by Type::Tiny::AUTOLOAD at line 1420, avg 5µs/call
# 6 times (7µs+0s) by Type::Tiny::AUTOLOAD at line 1428, avg 1µs/call
# 6 times (7µs+0s) by Type::Tiny::can at line 1398, avg 1µs/call
# 3 times (7µs+0s) by JSON::Schema::Modern::_assert__metaschema_vocabulary_classes at line 24 of (eval 360)[Sub/Quote.pm:3], avg 2µs/call
# once (9µs+0s) by JSON::Schema::Modern::new at line 98 of (eval 416)[Sub/Quote.pm:3]
# once (3µs+0s) by Type::Tiny::__ANON__[(eval 422)[/Users/ether/.perlbrew/libs/36.0@std/lib/perl5/Sub/Quote.pm:3]:16] at line 16 of (eval 422)[Sub/Quote.pm:3]
# once (3µs+0s) by JSON::Schema::Modern::new at line 106 of (eval 416)[Sub/Quote.pm:3]
# once (2µs+0s) by JSON::Schema::Modern::Result::new at line 99 of (eval 433)[Sub/Quote.pm:3] | |||||
sub Type::Tiny::CORE:sort; # opcode | |||||
# spent 345µs (106+239) within Type::Tiny::CORE:subst which was called 33 times, avg 10µs/call:
# 33 times (106µs+239µs) by Type::Tiny::__ANON__[/Users/ether/.perlbrew/libs/36.0@std/lib/perl5/Type/Tiny.pm:524] at line 522, avg 10µs/call |