Hi, The current code uses multiple if statements in a while loop. Since the index is fixed and conditions are mutually exclusive, replacing the if statements with a switch statement could improve efficiency. This pull request suggests refactoring for cleaner code and potential performance gains.
Comment From: pivotal-cla
@jinsim Please sign the Contributor License Agreement!
Click here to manually synchronize the status of this Pull Request.
See the FAQ for frequently asked questions.
Comment From: pivotal-cla
@jinsim Thank you for signing the Contributor License Agreement!
Comment From: wilkinsona
Thanks for the suggestion but I prefer the code as it's currently written. It's slightly more concise and I find it easier to read. BasicJsonParser is rarely, if ever, used in performance critical areas so I don't think the proposed changes are warranted. Thanks anyway.
Comment From: jinsim
@wilkinsona Thank you for your response. I appreciate your valid explanation. However, is there a specific reason for using repetitive if statements instead of an if-else statement? Since the index is fixed, it seems more appropriate to use if-else. If my understanding is incorrect, please let me know. Thank you.
Comment From: philwebb
I don't think there's a lot of benefit either way, as Andy said the code isn't performance critical and we don't want to make a change just for the sake of it.
Comment From: jinsim
@philwebb Thank you for your prompt response.