yiguolei commented on PR #8855: URL: https://github.com/apache/incubator-doris/pull/8855#issuecomment-1098618707
Add some performance test: class Status { public: Status() { _length = 0; _precise_code = 0; } Status(int i) { _precise_code = i % 17; } static Status OK() { return Status(); } static Status ERROR(int i) { return Status(i); } bool operator == (const Status& st) { return _precise_code == st._precise_code; } union { char _state[2048]; struct { // Message length == HEADER(7 bytes) + message size // Sometimes error message is empty, so that we could not use length==0 to indicate // whether there is error happens int64_t _length : 32; int64_t _code : 8; int64_t _precise_code : 16; int64_t _message : 8; // save message since here }; }; }; static void newstatus(benchmark::State& state) { // Code inside this loop is measured repeatedly bool result = false; int i = 0; for (auto _ : state) { Status status(i - 1); ++i; if (status == Status::ERROR(i)) { result = true; } else { result = false; } } } // Register the function as a benchmark BENCHMARK(newstatus); static void olapstatus(benchmark::State& state) { // Code before the loop is not measured bool result = false; int i = 0; for (auto _ : state) { //Status status(i - 1); ++i; if (i == 16) { result = true; } else { result = false; } } } BENCHMARK(olapstatus); new status is slower than olapstatus about 3.6%. Since there are lot of other work during query and the status is returned batch by batch, so that the impact could be ignored. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org