c3re / can2mqtt

CAN-Bus -- MQTT bridge: bidirectional, configurable and extendable
MIT License
84 stars 23 forks source link

maps instead of slices #32

Closed mxmxchere closed 1 year ago

mxmxchere commented 1 year ago
mxmxchere commented 1 year ago

This PR changes the internal representation of the can2mqtt.csv file from a slice to two maps (one for the lookup via can-id and one for the lookup via mqtt-topic). This will likely increase the execution time for small files but decrease execution time in the long run. a csv file with ~500 entries took ~10us on average to lookup with slices and ~3us lookup time with the map approach