Denoise core debugging and improve improve performance.

* Declutter and denoise the debug output in general.
* Avoid f-strings. They're nice to look at, but use a lot of ROM, RAM,
  and time during formatting.
* Remove all "debug" information from `KMKKeyboard.__repr__`. It's
  printed out once at init and the info it gave was useless at that
  point. Even more free memory.
* Add a memory footprint debug info after initialization.
This commit is contained in:
xs5871
2023-03-23 07:55:34 +00:00
committed by xs5871
parent 23d7c2d670
commit 5448cb4479
2 changed files with 99 additions and 115 deletions

View File

@@ -1,3 +1,8 @@
try:
from typing import Optional
except ImportError:
pass
from supervisor import ticks_ms
@@ -16,10 +21,12 @@ class Debug:
def __init__(self, name: str = __name__):
self.name = name
def __call__(self, *message: str) -> None:
def __call__(self, *message: str, name: Optional[str] = None) -> None:
if not name:
name = self.name
print(ticks_ms(), end=' ')
print(self.name, end=': ')
print(*message)
print(name, end=': ')
print(*message, sep='')
@property
def enabled(self) -> bool: