k-i-d-d opened a new pull request, #10629: URL: https://github.com/apache/doris/pull/10629
# Proposed changes Issue Number: close #10583 ## Problem Summary: #### Motivation In the previous test, consume mem tracker based on tcmalloc hook is expected to bring 2% performance loss to the query. But in extreme cases, when load JSON data, the tcmalloc hook may bring about a 30% performance loss. The performance loss is divided into five parts: 1. Calculate the actual system memory size of this alloc/free, loss 3%; 2. After accumulating to 2M, consume mem tracker, loss 2%; 3. Get bthread tls, loss 7%; 4. The function call introduced for consuming mem tracker in tls; 5. The hook itself;  #### Solution 1. Avoid trying to get bthread tls in every hook; 2. Optimize unnecessary conditional judgments; 3. Reduce the number of function call layers in the hook; 4. Modified to consume mem tracker after accumulating 4M; The optimized performance loss is divided into three parts: 1. Calculate the actual system memory size of this alloc/free; 2. Consume mem tracker after accumulating 4M; 3. The hook itself; In the test environment, this can reduce the performance loss of tcmalloc hook from 6% to 2%.  ## Checklist(Required) 1. Does it affect the original behavior: (Yes/No/I Don't know) 2. Has unit tests been added: (Yes/No/No Need) 3. Has document been added or modified: (Yes/No/No Need) 4. Does it need to update dependencies: (Yes/No) 5. Are there any changes that cannot be rolled back: (Yes/No) ## Further comments If this is a relatively large or complex change, kick off the discussion at [d...@doris.apache.org](mailto:d...@doris.apache.org) by explaining why you chose the solution you did and what alternatives you considered, etc... -- 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