diff options
| author | levlam <levlam@telegram.org> | 2020-06-15 04:52:56 +0300 |
|---|---|---|
| committer | levlam <levlam@telegram.org> | 2020-06-15 04:52:56 +0300 |
| commit | 0cf4fea1ff6fc37118638a616c9f6e95b19451f0 (patch) | |
| tree | dce8b9edd21f70f6294b6a0662f9a01421f531e2 /benchmark/bench_log.cpp | |
| parent | ea4841a37c156addb2c4167ca6d62b51c4aa79a4 (diff) | |
Remove enum usages for static constants creation.
GitOrigin-RevId: 2a88fd2cd961398a09403fe35a15ae56372a44f8
Diffstat (limited to 'benchmark/bench_log.cpp')
| -rw-r--r-- | benchmark/bench_log.cpp | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/benchmark/bench_log.cpp b/benchmark/bench_log.cpp index afc23e9a9..63807b2fd 100644 --- a/benchmark/bench_log.cpp +++ b/benchmark/bench_log.cpp @@ -40,8 +40,8 @@ class IostreamWriteBench : public td::Benchmark { protected: std::string file_name_; std::ofstream stream; - enum { buffer_size = 1 << 20 }; - char buffer[buffer_size]; + static constexpr std::size_t BUFFER_SIZE = 1 << 20; + char buffer[BUFFER_SIZE]; public: std::string get_description() const override { @@ -52,7 +52,7 @@ class IostreamWriteBench : public td::Benchmark { file_name_ = create_tmp_file(); stream.open(file_name_.c_str()); CHECK(stream.is_open()); - // stream.rdbuf()->pubsetbuf(buffer, buffer_size); + // stream.rdbuf()->pubsetbuf(buffer, BUFFER_SIZE); } void run(int n) override { @@ -71,8 +71,8 @@ class FILEWriteBench : public td::Benchmark { protected: std::string file_name_; FILE *file; - enum { buffer_size = 1 << 20 }; - char buffer[buffer_size]; + static constexpr std::size_t BUFFER_SIZE = 1 << 20; + char buffer[BUFFER_SIZE]; public: std::string get_description() const override { @@ -82,7 +82,7 @@ class FILEWriteBench : public td::Benchmark { void start_up() override { file_name_ = create_tmp_file(); file = fopen(file_name_.c_str(), "w"); - // setvbuf(file, buffer, _IOFBF, buffer_size); + // setvbuf(file, buffer, _IOFBF, BUFFER_SIZE); } void run(int n) override { @@ -123,8 +123,8 @@ class LogWriteBench : public td::Benchmark { std::string file_name_; std::ofstream stream; std::streambuf *old_buf; - enum { buffer_size = 1 << 20 }; - char buffer[buffer_size]; + static constexpr std::size_t BUFFER_SIZE = 1 << 20; + char buffer[BUFFER_SIZE]; public: std::string get_description() const override { |
