From 1a61723c2cca63de15fd3f47a50619274f0c1799 Mon Sep 17 00:00:00 2001 From: Shane Smiskol Date: Thu, 15 Aug 2024 15:40:45 -0700 Subject: [PATCH] save ~4-5% CPU at 100hz, we don't modify after so no need to deepcopy btw pickle.loads(pickle.dumps()) is faster by ~1% CPU --- selfdrive/car/interfaces.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/selfdrive/car/interfaces.py b/selfdrive/car/interfaces.py index 90aaec40b4..0367aca3fb 100644 --- a/selfdrive/car/interfaces.py +++ b/selfdrive/car/interfaces.py @@ -1,4 +1,3 @@ -import copy import json import os import numpy as np @@ -247,9 +246,8 @@ class CarInterfaceBase(ABC): if ret.cruiseState.speedCluster == 0: ret.cruiseState.speedCluster = ret.cruiseState.speed - # copy back for next iteration - # TODO: do we need to deepcopy? - self.CS.out = copy.deepcopy(ret) + # save for next iteration + self.CS.out = ret return ret