|
[sync] Add constexpr to EnumSet
constexpr allows the programmer to assert their intention that a
particular function or variable should be evaluatable at compile time
given the correct circumstances. If one adheres to the restrictions
imposed by constexpr, the compiler can often aggressively optimize
away code, leading to smaller binary size and improved performance.
This cl makes ModelTypeSet's varargs constructor as well as All() and
FromRange()
constexpr. It leverages this to make several of model_type.h's Types()
functions contexpr as well.
In my testing, this saves about 34 kb from the release binary. A
synthetic performance test that calls UserTypes(), CoreTypes() etc. in a
loop ran 3-4x faster on both debug and release builds, although the
magnitude of the difference was obviously smaller in the release builds.
Review-Url: https://codereview.chromium.org/2859033002
Cr-Commit-Position: refs/heads/master@{#478847}
Committed: https://chromium.googlesource.com/chromium/src/+/4d8a7c16ddb43b19a0768c68ccb2c72400879485
Total comments: 23
Total comments: 2
|
Unified diffs |
Side-by-side diffs |
Delta from patch set |
Stats (+163 lines, -196 lines) |
Patch |
|
M |
components/browser_sync/BUILD.gn
|
View
|
1
2
|
1 chunk |
+1 line, -1 line |
0 comments
|
Download
|
|
M |
components/browser_sync/DEPS
|
View
|
1
2
|
1 chunk |
+1 line, -1 line |
0 comments
|
Download
|
|
M |
components/browser_sync/profile_sync_components_factory_impl.cc
|
View
|
1
2
|
1 chunk |
+1 line, -1 line |
0 comments
|
Download
|
|
M |
components/browser_sync/profile_sync_service.cc
|
View
|
1
2
|
1 chunk |
+1 line, -1 line |
0 comments
|
Download
|
|
M |
components/reading_list/core/BUILD.gn
|
View
|
1
2
|
3 chunks |
+2 lines, -22 lines |
0 comments
|
Download
|
|
D |
components/reading_list/core/reading_list.gni
|
View
|
1
2
|
1 chunk |
+0 lines, -9 lines |
0 comments
|
Download
|
|
D |
components/reading_list/core/reading_list_switches.h
|
View
|
1
2
|
1 chunk |
+0 lines, -15 lines |
0 comments
|
Download
|
|
M |
components/reading_list/core/reading_list_switches.cc
|
View
|
1
2
|
1 chunk |
+0 lines, -17 lines |
0 comments
|
Download
|
|
A |
components/reading_list/features/BUILD.gn
|
View
|
1
2
|
1 chunk |
+21 lines, -0 lines |
0 comments
|
Download
|
|
A + |
components/reading_list/features/reading_list.gni
|
View
|
1
2
|
0 chunks |
+-1 lines, --1 lines |
0 comments
|
Download
|
|
A + |
components/reading_list/features/reading_list_switches.h
|
View
|
1
2
|
2 chunks |
+3 lines, -3 lines |
0 comments
|
Download
|
|
A + |
components/reading_list/features/reading_list_switches.cc
|
View
|
1
2
|
1 chunk |
+3 lines, -3 lines |
0 comments
|
Download
|
|
M |
components/sync/BUILD.gn
|
View
|
1
2
|
1 chunk |
+1 line, -1 line |
0 comments
|
Download
|
|
M |
components/sync/base/DEPS
|
View
|
1
2
|
1 chunk |
+1 line, -0 lines |
0 comments
|
Download
|
|
M |
components/sync/base/enum_set.h
|
View
|
1
|
3 chunks |
+39 lines, -22 lines |
0 comments
|
Download
|
|
M |
components/sync/base/enum_set_unittest.cc
|
View
|
|
2 chunks |
+17 lines, -0 lines |
0 comments
|
Download
|
|
M |
components/sync/base/model_type.h
|
View
|
1
2
|
3 chunks |
+73 lines, -14 lines |
0 comments
|
Download
|
|
M |
components/sync/driver/data_type_manager_impl.cc
|
View
|
1
2
|
1 chunk |
+0 lines, -1 line |
0 comments
|
Download
|
|
M |
components/sync/driver/glue/sync_backend_host_impl_unittest.cc
|
View
|
|
1 chunk |
+0 lines, -1 line |
0 comments
|
Download
|
|
M |
components/sync/engine_impl/sync_encryption_handler_impl_unittest.cc
|
View
|
|
1 chunk |
+0 lines, -1 line |
0 comments
|
Download
|
|
M |
components/sync/syncable/DEPS
|
View
|
1
2
|
1 chunk |
+0 lines, -1 line |
0 comments
|
Download
|
|
M |
components/sync/syncable/model_type.cc
|
View
|
1
2
|
4 chunks |
+0 lines, -83 lines |
0 comments
|
Download
|
Total messages: 81 (71 generated)
|