From ae884762ca300b265355afb6aeaed5010352f167 Mon Sep 17 00:00:00 2001 From: Daniel Schadt Date: Thu, 18 Nov 2021 19:37:05 +0100 Subject: switch order of operands in SH analyzer MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Comparing the int is a very cheap operation, and it is also a very good indicator already that we've found the right event. Due to the short circuiting behaviour of &&, it is better to check that first before doing the Log::is_boss check - which is relatively costly. Remember that we do this check for every buff application event! This brings a speedup of around 50x: new: 654.1±25.18µs old: 34.9±0.69ms --- src/analyzers/raids/w5.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/analyzers/raids/w5.rs b/src/analyzers/raids/w5.rs index 747bda2..d00eab8 100644 --- a/src/analyzers/raids/w5.rs +++ b/src/analyzers/raids/w5.rs @@ -46,7 +46,7 @@ impl<'log> Analyzer for SoullessHorror<'log> { .. } = event.kind() { - self.log.is_boss(*destination_agent_addr) && *buff_id == DESMINA_DEATH_BUFF + *buff_id == DESMINA_DEATH_BUFF && self.log.is_boss(*destination_agent_addr) } else { false } -- cgit v1.2.3