[sledge] Optimize Trace enabled checking

Summary:
If either all or no tracing is enabled, it is not necessary to compute
the module and function names for each Trace operation to determine
whether or not it is enabled. This diff optimizes this case.

Reviewed By: ngorogiannis

Differential Revision: D27564869

fbshipit-source-id: bf766eb2f
master
Josh Berdine 4 years ago committed by Facebook GitHub Bot
parent df26c0f231
commit ed71043920

@ -169,8 +169,10 @@ let split_mod_fun_name s =
(mod_name, fun_name) (mod_name, fun_name)
let enabled mod_fun_name = let enabled mod_fun_name =
let mod_name, fun_name = split_mod_fun_name mod_fun_name in
let {trace_all; trace_mods_funs; _} = !config in let {trace_all; trace_mods_funs; _} = !config in
if Map.is_empty trace_mods_funs then trace_all
else
let mod_name, fun_name = split_mod_fun_name mod_fun_name in
match Map.find mod_name trace_mods_funs with match Map.find mod_name trace_mods_funs with
| {trace_mod; trace_funs} -> ( | {trace_mod; trace_funs} -> (
try Map.find fun_name trace_funs try Map.find fun_name trace_funs

Loading…
Cancel
Save