Mercurial > code > home > repos > homeauto
changeset 1697:88f6e9bf69d1
stats and non-debug mode speedups
author | drewp@bigasterisk.com |
---|---|
date | Tue, 28 Sep 2021 00:32:16 -0700 |
parents | cdf706cf5f82 |
children | 58f1877780b9 |
files | service/mqtt_to_rdf/inference.py service/mqtt_to_rdf/stmt_chunk.py |
diffstat | 2 files changed, 5 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/service/mqtt_to_rdf/inference.py Mon Sep 27 22:56:25 2021 -0700 +++ b/service/mqtt_to_rdf/inference.py Tue Sep 28 00:32:16 2021 -0700 @@ -164,7 +164,9 @@ fullBinding: CandidateBinding = self._prevBindings().copy() fullBinding.addNewBindings(newBinding) isNew = fullBinding not in self._seenBindings - ringlog.debug(f'{INDENT*7} {self} considering {newBinding=} to make {fullBinding}. {isNew=}') + + if ringlog.isEnabledFor(logging.DEBUG): + ringlog.debug(f'{INDENT*7} {self} considering {newBinding=} to make {fullBinding}. {isNew=}') # if self.slog: # self.slog.looperConsider(self, newBinding, fullBinding, isNew) @@ -326,6 +328,7 @@ raise NotImplementedError(f'trying too many permutations {len(chunks)=}') permsTried += 1 + stats['permsTried'] += permsTried odolog.debug(f'{INDENT*5} no perms worked- rule cannot match anything') raise NoOptions()
--- a/service/mqtt_to_rdf/stmt_chunk.py Mon Sep 27 22:56:25 2021 -0700 +++ b/service/mqtt_to_rdf/stmt_chunk.py Tue Sep 28 00:32:16 2021 -0700 @@ -109,7 +109,7 @@ # if log.isEnabledFor(logging.DEBUG): # log.debug(f'{INDENT*6} computing {self}.ruleMatchesFrom({workingSet}') allChunksIter = workingSet.allChunks() - if "stable failures please": + if log.isEnabledFor(logging.DEBUG): # makes failures a bit more stable, but shows up in profiling allChunksIter = sorted(allChunksIter) for chunk in allChunksIter: try: