[ https://issues.apache.org/jira/browse/RANGER-3395?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17412940#comment-17412940 ]
caozhiqiang edited comment on RANGER-3395 at 9/10/21, 4:03 AM: --------------------------------------------------------------- !3395-1.png|width=916,height=211! [~pradeep], above is a performance report from a java performance analyze tool. After removed Integer.toString() call, RangerDefaultAuditHandler.generateNextAuditEventId() would no longer appear in performance report. And I also use below code to test Integer.toString() performance: {code:java} int nextId = counter.getAndIncrement(); long startTime = System.currentTimeMillis(); for (int i = 0; i < 500000; i++){ String ret1 = UUID + Integer.toString(nextId); } long endTime = System.currentTimeMillis(); long totalTime = endTime - startTime; System.out.println(totalTime); long startTime2 = System.currentTimeMillis(); for (int i = 0; i < 500000; i++) { String ret2 = UUID + nextId; } long endTime2 = System.currentTimeMillis(); long totalTime2 = endTime2 - startTime2; System.out.println(totalTime2); {code} With Integer.toString() cost 57ms and without Integer.toString() only cost 10ms, which takes 5 times as much time as removing Integer.toString(). Thanks for your review. !3395-2.png|width=462,height=390! was (Author: caozhiqiang): !3395-1.png|width=916,height=211! [~pradeep], above is a performance report from a java performance analyze tool. After removed Integer.toString() call, RangerDefaultAuditHandler.generateNextAuditEventId() would no longer appear in performance report. > Unnecessary 'Integer.toString()' call which degrade performance > --------------------------------------------------------------- > > Key: RANGER-3395 > URL: https://issues.apache.org/jira/browse/RANGER-3395 > Project: Ranger > Issue Type: Improvement > Components: plugins > Affects Versions: 2.0.1 > Reporter: caozhiqiang > Assignee: caozhiqiang > Priority: Major > Attachments: 3395-1.png, 3395-2.png, > RANGER-3395-branch-2.0.1.001.patch > > > There are several place used unnecessary Integer.toString() call and take to > much time in program running. these should be removed. -- This message was sent by Atlassian Jira (v8.3.4#803005)