Marchowes / pyProm

Surface Network Analyzer.
BSD 3-Clause "New" or "Revised" License
6 stars 2 forks source link

Stop using Gridpoints internally. Use Tuples instead #141

Closed Marchowes closed 5 years ago

Marchowes commented 5 years ago

Massive performance and memory improvements can be had by eliminating the internal use of Gridpoints, and instead use tuples.

Tuples take about 1/10th the time to create, and take up far less space in memory.

Gridpoints/SpotElevations are used extensively within pyProm for handling basic nodes, the problem is creating and destroying these objects is actually a very wasteful process. These were originally intended as a means to make pyProm more "pythonic". These objects serve no real purpose other than to display to the user the node in question. Therefore, it makes sense to instead use a tuple in place of an object.

For Instance GridPoint(1,2,100) could just as easily be tuple(1,2,100). Data gathered from Getters can convert these tuples to GridPoints if the user requests them.

This also provides a clear improvement when saving these objects to files.

Marchowes commented 5 years ago

Will want to add classmethods too for creating objects -- which is really more Java like than Python -- oh well.

Marchowes commented 5 years ago

fixed