[libc++] Avoid ranges::upper_bound inside <format> (#173150)
This reduces the time to include `<vector>` from 565ms to 452ms on my machine.
This commit is contained in:
parent
d52507d94f
commit
2f2fe489d7
@ -61,7 +61,7 @@
|
||||
#ifndef _LIBCPP___FORMAT_EXTENDED_GRAPHEME_CLUSTER_TABLE_H
|
||||
#define _LIBCPP___FORMAT_EXTENDED_GRAPHEME_CLUSTER_TABLE_H
|
||||
|
||||
#include <__algorithm/ranges_upper_bound.h>
|
||||
#include <__algorithm/upper_bound.h>
|
||||
#include <__config>
|
||||
#include <__cstddef/ptrdiff_t.h>
|
||||
#include <__iterator/access.h>
|
||||
@ -1647,7 +1647,8 @@ _LIBCPP_HIDE_FROM_ABI inline constexpr uint32_t __entries[1501] = {
|
||||
// size. Then the upper bound for code point 3 will return the entry after
|
||||
// 0x1810. After moving to the previous entry the algorithm arrives at the
|
||||
// correct entry.
|
||||
ptrdiff_t __i = std::ranges::upper_bound(__entries, (__code_point << 11) | 0x7ffu) - __entries;
|
||||
ptrdiff_t __i =
|
||||
std::upper_bound(std::begin(__entries), std::end(__entries), (__code_point << 11) | 0x7ffu) - __entries;
|
||||
if (__i == 0)
|
||||
return __property::__none;
|
||||
|
||||
|
||||
@ -61,7 +61,7 @@
|
||||
#ifndef _LIBCPP___FORMAT_INDIC_CONJUNCT_BREAK_TABLE_H
|
||||
#define _LIBCPP___FORMAT_INDIC_CONJUNCT_BREAK_TABLE_H
|
||||
|
||||
#include <__algorithm/ranges_upper_bound.h>
|
||||
#include <__algorithm/upper_bound.h>
|
||||
#include <__config>
|
||||
#include <__cstddef/ptrdiff_t.h>
|
||||
#include <__iterator/access.h>
|
||||
@ -531,7 +531,8 @@ _LIBCPP_HIDE_FROM_ABI inline constexpr uint32_t __entries[403] = {
|
||||
// size. Then the upper bound for code point 3 will return the entry after
|
||||
// 0x1810. After moving to the previous entry the algorithm arrives at the
|
||||
// correct entry.
|
||||
ptrdiff_t __i = std::ranges::upper_bound(__entries, (__code_point << 11) | 0x7ffu) - __entries;
|
||||
ptrdiff_t __i =
|
||||
std::upper_bound(std::begin(__entries), std::end(__entries), (__code_point << 11) | 0x7ffu) - __entries;
|
||||
if (__i == 0)
|
||||
return __property::__none;
|
||||
|
||||
|
||||
@ -61,9 +61,10 @@
|
||||
#ifndef _LIBCPP___FORMAT_WIDTH_ESTIMATION_TABLE_H
|
||||
#define _LIBCPP___FORMAT_WIDTH_ESTIMATION_TABLE_H
|
||||
|
||||
#include <__algorithm/ranges_upper_bound.h>
|
||||
#include <__algorithm/upper_bound.h>
|
||||
#include <__config>
|
||||
#include <__cstddef/ptrdiff_t.h>
|
||||
#include <__iterator/access.h>
|
||||
#include <cstdint>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
@ -255,7 +256,8 @@ inline constexpr uint32_t __table_upper_bound = 0x0003fffd;
|
||||
if (__code_point < (__entries[0] >> 14))
|
||||
return 1;
|
||||
|
||||
ptrdiff_t __i = std::ranges::upper_bound(__entries, (__code_point << 14) | 0x3fffu) - __entries;
|
||||
ptrdiff_t __i =
|
||||
std::upper_bound(std::begin(__entries), std::end(__entries), (__code_point << 14) | 0x3fffu) - __entries;
|
||||
if (__i == 0)
|
||||
return 1;
|
||||
|
||||
|
||||
@ -135,7 +135,8 @@ _LIBCPP_HIDE_FROM_ABI inline constexpr uint32_t __entries[{size}] = {{
|
||||
// size. Then the upper bound for code point 3 will return the entry after
|
||||
// 0x1810. After moving to the previous entry the algorithm arrives at the
|
||||
// correct entry.
|
||||
ptrdiff_t __i = std::ranges::upper_bound(__entries, (__code_point << 11) | 0x7ffu) - __entries;
|
||||
ptrdiff_t __i =
|
||||
std::upper_bound(std::begin(__entries), std::end(__entries), (__code_point << 11) | 0x7ffu) - __entries;
|
||||
if (__i == 0)
|
||||
return __property::__none;
|
||||
|
||||
@ -212,7 +213,7 @@ MSVC_FORMAT_UCD_TABLES_HPP_TEMPLATE = """
|
||||
#ifndef _LIBCPP___FORMAT_EXTENDED_GRAPHEME_CLUSTER_TABLE_H
|
||||
#define _LIBCPP___FORMAT_EXTENDED_GRAPHEME_CLUSTER_TABLE_H
|
||||
|
||||
#include <__algorithm/ranges_upper_bound.h>
|
||||
#include <__algorithm/upper_bound.h>
|
||||
#include <__config>
|
||||
#include <__cstddef/ptrdiff_t.h>
|
||||
#include <__iterator/access.h>
|
||||
|
||||
@ -128,7 +128,8 @@ _LIBCPP_HIDE_FROM_ABI inline constexpr uint32_t __entries[{size}] = {{
|
||||
// size. Then the upper bound for code point 3 will return the entry after
|
||||
// 0x1810. After moving to the previous entry the algorithm arrives at the
|
||||
// correct entry.
|
||||
ptrdiff_t __i = std::ranges::upper_bound(__entries, (__code_point << 11) | 0x7ffu) - __entries;
|
||||
ptrdiff_t __i =
|
||||
std::upper_bound(std::begin(__entries), std::end(__entries), (__code_point << 11) | 0x7ffu) - __entries;
|
||||
if (__i == 0)
|
||||
return __property::__none;
|
||||
|
||||
@ -205,7 +206,7 @@ MSVC_FORMAT_UCD_TABLES_HPP_TEMPLATE = """
|
||||
#ifndef _LIBCPP___FORMAT_INDIC_CONJUNCT_BREAK_TABLE_H
|
||||
#define _LIBCPP___FORMAT_INDIC_CONJUNCT_BREAK_TABLE_H
|
||||
|
||||
#include <__algorithm/ranges_upper_bound.h>
|
||||
#include <__algorithm/upper_bound.h>
|
||||
#include <__config>
|
||||
#include <__cstddef/ptrdiff_t.h>
|
||||
#include <__iterator/access.h>
|
||||
|
||||
@ -170,7 +170,8 @@ inline constexpr uint32_t __table_upper_bound = 0x{upper_bound:08x};
|
||||
if (__code_point < (__entries[0] >> 14))
|
||||
return 1;
|
||||
|
||||
ptrdiff_t __i = std::ranges::upper_bound(__entries, (__code_point << 14) | 0x3fffu) - __entries;
|
||||
ptrdiff_t __i =
|
||||
std::upper_bound(std::begin(__entries), std::end(__entries), (__code_point << 14) | 0x3fffu) - __entries;
|
||||
if (__i == 0)
|
||||
return 1;
|
||||
|
||||
@ -244,9 +245,10 @@ TABLES_HPP_TEMPLATE = """
|
||||
#ifndef _LIBCPP___FORMAT_WIDTH_ESTIMATION_TABLE_H
|
||||
#define _LIBCPP___FORMAT_WIDTH_ESTIMATION_TABLE_H
|
||||
|
||||
#include <__algorithm/ranges_upper_bound.h>
|
||||
#include <__algorithm/upper_bound.h>
|
||||
#include <__config>
|
||||
#include <__cstddef/ptrdiff_t.h>
|
||||
#include <__iterator/access.h>
|
||||
#include <cstdint>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user