mirror of
https://github.com/facebook/sapling.git
synced 2024-10-05 14:28:17 +03:00
63971e5fba
Summary: I was iterating on a single unit test and noticed our compilation times have crossed the threshold from bad to horrific. I was seeing 30+ seconds per unit test .cpp file. After playing around with -ftime-trace, I found some obvious low-hanging fruit: - forward declaration opportunities - pImpl - moving some implementation to cpp files Some bigger opportunities remain: The folly/portability/GTest.h and folly/portability/Windows.h header situation isn't great. They pull in winsock2.h which alone takes two seconds to compile. We also probably don't need the folly/portability/Unistd.h compatibility wrappers in EdenFS or Watchman. Also, folly/Format.h is quite expensive, and there are other dependencies that pull in Boost MPL. Reviewed By: xavierd Differential Revision: D38195736 fbshipit-source-id: 9c64bab5ff5851d5a896674712aec71d6780c79a
38 lines
1.2 KiB
C++
38 lines
1.2 KiB
C++
/*
|
|
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
*
|
|
* This software may be used and distributed according to the terms of the
|
|
* GNU General Public License version 2.
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include "eden/common/utils/OptionSet.h"
|
|
#include "eden/fs/service/gen-cpp2/eden_types.h"
|
|
|
|
namespace facebook::eden {
|
|
|
|
struct EntryAttributeFlags
|
|
: OptionSet<EntryAttributeFlags, std::underlying_type_t<FileAttributes>> {
|
|
constexpr static EntryAttributeFlags raw(FileAttributes raw) {
|
|
return OptionSet<
|
|
EntryAttributeFlags,
|
|
std::underlying_type_t<FileAttributes>>::raw(folly::to_underlying(raw));
|
|
}
|
|
constexpr static EntryAttributeFlags raw(
|
|
std::underlying_type_t<FileAttributes> raw) {
|
|
return OptionSet<
|
|
EntryAttributeFlags,
|
|
std::underlying_type_t<FileAttributes>>::raw(raw);
|
|
}
|
|
};
|
|
|
|
inline constexpr auto ENTRY_ATTRIBUTE_TYPE =
|
|
EntryAttributeFlags::raw(FileAttributes::SOURCE_CONTROL_TYPE);
|
|
inline constexpr auto ENTRY_ATTRIBUTE_SIZE =
|
|
EntryAttributeFlags::raw(FileAttributes::FILE_SIZE);
|
|
inline constexpr auto ENTRY_ATTRIBUTE_SHA1 =
|
|
EntryAttributeFlags::raw(FileAttributes::SHA1_HASH);
|
|
|
|
} // namespace facebook::eden
|