linrrzqqq opened a new pull request, #67237:
URL: https://github.com/apache/doris/pull/67237

   ### What problem does this PR solve?
   
   Issue Number: close #xxx
   
   Related PR: #65304
   
   Problem Summary:
   
   PR #65304 added the following libraries to `COMMON_THIRDPARTY`:
   
   ```cmake
   list(APPEND COMMON_THIRDPARTY m lance_c)
   ```
   This unconditionally added an early -lm to the BE link command, before 
Doris's own glibc-compatibility library.
   In the current toolchain, libm.so is a GNU ld script:`GROUP ( 
./libglibc-compatibility.a ../../lib/libm.so.6 )`
   
   As a result, the early -lm resolves exp, log, and log2 from the toolchain's 
compatibility archive before Doris's optimized compatibility implementations 
are considered. This causes significant performance regressions in arithmetic 
benchmarks:
   - exp: approximately 220%
   - ln: approximately 167%
   - log: approximately 197%
   - log2: approximately 165%
   
   In this pr, remove the unconditional addition of `m` and `lance_c` to 
`COMMON_THIRDPARTY`, and the imported `lance_c` target is retained, so future 
Lance consumers can link it explicitly through `target_link_libraries()` when 
the corresponding feature is enabled.
   
   This keeps the existing `glibc-compatibility` link ordering unchanged and 
avoids
   affecting unrelated BE targets.
   
   #### performance
   ```text
   Doris> select count(exp(db)) from double_ranges;
   +----------------+
   | count(exp(db)) |
   +----------------+
   |       50000000 |
   +----------------+
   1 row in set (0.980 sec)
   
   Doris> select count(exp(db)) from double_ranges;
   +----------------+
   | count(exp(db)) |
   +----------------+
   |       50000000 |
   +----------------+
   1 row in set (0.347 sec)
   
   
   Doris> select count(ln(db)), count(ln(in_one)) from double_ranges;
   +---------------+-------------------+
   | count(ln(db)) | count(ln(in_one)) |
   +---------------+-------------------+
   |      50000000 |          50000000 |
   +---------------+-------------------+
   1 row in set (1.486 sec)
   
   Doris> select count(ln(db)), count(ln(in_one)) from double_ranges;
   +---------------+-------------------+
   | count(ln(db)) | count(ln(in_one)) |
   +---------------+-------------------+
   |      50000000 |          50000000 |
   +---------------+-------------------+
   1 row in set (0.607 sec)
   
   
   Doris> select count(log(db, db)), count(log(in_one, db)), count(log(db, 
in_one)), count(log(db, in_ten)) from double_ranges;
   
+--------------------+------------------------+------------------------+------------------------+
   | count(log(db, db)) | count(log(in_one, db)) | count(log(db, in_one)) | 
count(log(db, in_ten)) |
   
+--------------------+------------------------+------------------------+------------------------+
   |           50000000 |               49999990 |               50000000 |     
          50000000 |
   
+--------------------+------------------------+------------------------+------------------------+
   1 row in set (5.944 sec)
   
   Doris> select count(log(db, db)), count(log(in_one, db)), count(log(db, 
in_one)), count(log(db, in_ten)) from double_ranges;
   
+--------------------+------------------------+------------------------+------------------------+
   | count(log(db, db)) | count(log(in_one, db)) | count(log(db, in_one)) | 
count(log(db, in_ten)) |
   
+--------------------+------------------------+------------------------+------------------------+
   |           50000000 |               49999990 |               50000000 |     
          50000000 |
   
+--------------------+------------------------+------------------------+------------------------+
   1 row in set (2.356 sec)
   
   
   Doris> select count(log2(db)), count(log2(in_one)) from double_ranges;
   +-----------------+---------------------+
   | count(log2(db)) | count(log2(in_one)) |
   +-----------------+---------------------+
   |        50000000 |            50000000 |
   +-----------------+---------------------+
   1 row in set (1.616 sec)
   
   Doris> select count(log2(db)), count(log2(in_one)) from double_ranges;
   +-----------------+---------------------+
   | count(log2(db)) | count(log2(in_one)) |
   +-----------------+---------------------+
   |        50000000 |            50000000 |
   +-----------------+---------------------+
   1 row in set (0.655 sec)
   ```
   


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to