Code length pretty much has nothing to do with performance. A 5 line long code can perform as bad as a 100 line one. Really depends on what that code is doing.
And, by looking at your code, it seems like it is something called on map change. Something executed at map change most likely has no effect on lag during the map.