M0r13n / pyais

AIS message decoding and encoding in Python (AIVDM/AIVDO)
MIT License
176 stars 61 forks source link

remove unnecessary type casts #100

Closed M0r13n closed 1 year ago

M0r13n commented 1 year ago

Before

$ /home/leon/projects/pyais/venv/bin/python /home/leon/projects/pyais/performance.py
Decoding 82758 messages took: 3.849092721939087
ERRORS 2
$ /home/leon/projects/pyais/venv/bin/python /home/leon/projects/pyais/performance.py
Decoding 82758 messages took: 3.7922966480255127
ERRORS 2
$ /home/leon/projects/pyais/venv/bin/python /home/leon/projects/pyais/performance.py
Decoding 82758 messages took: 3.8527872562408447
ERRORS 2

After

$ /home/leon/projects/pyais/venv/bin/python /home/leon/projects/pyais/performance.py
Decoding 82758 messages took: 3.1997904777526855
ERRORS 2
$ /home/leon/projects/pyais/venv/bin/python /home/leon/projects/pyais/performance.py
Decoding 82758 messages took: 3.1322197914123535
ERRORS 2
$ /home/leon/projects/pyais/venv/bin/python /home/leon/projects/pyais/performance.py
Decoding 82758 messages took: 3.2007410526275635
ERRORS 2

So the total runtime is reduced from ~3.8s to ~3.2s which is about 15% better. Even tough performance was never the primary goal of pyais, this is still a nice to have.

M0r13n commented 1 year ago

@Inrixia What do you think? Did I miss something?

Inrixia commented 1 year ago

Looks great!