1

I have a big blf file, blf_file.blf, and an associated dbc file, dbc_file.dbc. I need to read and decode all the messages and store them in a list. For this I use the python-can library:

decoded_mess = []

db = cantools.db.load_file('dbc_file.dbc')

with can.BLFReader('blf_file.blf') as can_log:
  for msg in can_log:
    decoded_mess.append(
      db.decode_message(msg.arbitration_id, msg.data)
      )
  

However, for my blf files (> 100 MB), this takes up to 5 minutes.

Is there a way to speed this up? In the end, I want to store every signal in a seperate list, so list comprehension is not an option.

Community
  • 1
  • 1
  • I don't think you can speed the reading part up. Yet you can start your processing while reading if you don't need the list to full before starting. – Benoît Jun 17 '19 at 11:42

0 Answers0