Java代码运行速度问题
JSONObject jsonObject = util.SearchEmployeeInfo(userCode);
if ("500".equals(jsonObject.get("code").toString())) {
return -1;
}
JSONObject jsonObjectResult = (JSONObject)JSON.toJSON(jsonObject.get("result"));
String departmentName = jsonObjectResult.getString("department_name");
if (!"A部门".equals(departmentName)) {
return -2;
}
JSONObject jsonObject = util.SearchEmployeeInfo(userCode);
if ("500".equals(jsonObject.get("code").toString())) {
return -1;
}
if (!"A部门".equals(((JSONObject)JSON.toJSON(jsonObject.get("result"))).getString("department_name"))) {
return -2;
}
请问这两种方式哪种运行速度会快一点呢,或者从其他方面考虑哪种更好一点呢?(个人感觉第一种更便于阅读,但需要创建临时变量占用内存)