Repository navigation
Commit fb83653
committed
Block Processor: Normalize the searched block type once.
`next_delimiter( $block_type )` called `is_block_type()` for every
delimiter, which calls `are_equal_block_types()`. That scans both block
types for `/` and builds a `core/` string whenever exactly one of them
has a namespace.
Normalize the searched block type once per call. A delimiter whose
block type has no namespace then matches only the part after `core/`,
and every other delimiter matches the full type. Both comparisons check
the length first.
`next_block( $block_type )` takes 13% to 21% less time.
Adds explicit namespaces and search types which cannot match to the
test comparing `next_delimiter()` with `next_token()`.
See #66138.1 parent 12e3fc6 commit fb83653
2 files changed
Lines changed: 25 additions & 2 deletions
File tree
- src/wp-includes
- tests/phpunit/tests/block-processor
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
678 | 678 | | |
679 | 679 | | |
680 | 680 | | |
| 681 | + | |
| 682 | + | |
| 683 | + | |
| 684 | + | |
| 685 | + | |
681 | 686 | | |
682 | 687 | | |
683 | | - | |
| 688 | + | |
| 689 | + | |
| 690 | + | |
| 691 | + | |
| 692 | + | |
| 693 | + | |
| 694 | + | |
| 695 | + | |
| 696 | + | |
| 697 | + | |
| 698 | + | |
| 699 | + | |
| 700 | + | |
| 701 | + | |
| 702 | + | |
| 703 | + | |
| 704 | + | |
| 705 | + | |
684 | 706 | | |
685 | 707 | | |
686 | 708 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1717 | 1717 | | |
1718 | 1718 | | |
1719 | 1719 | | |
| 1720 | + | |
1720 | 1721 | | |
1721 | 1722 | | |
1722 | | - | |
| 1723 | + | |
1723 | 1724 | | |
1724 | 1725 | | |
1725 | 1726 | | |
| |||
0 commit comments