Skip to content

str(HGVertex) #153

Closed
TravelMapping/DataProcessing
#416

Description

@yakra

for v in self.vertices.values():
# all vertices for simple graph
simplefile.write(v.unique_name+' '+str(v.lat)+' '+str(v.lng)+'\n')
v.s_vertex_num = sv
sv += 1
# visible vertices...
if v.visibility >= 1:
# for traveled graph,
travelfile.write(v.unique_name+' '+str(v.lat)+' '+str(v.lng)+'\n')
v.t_vertex_num = tv
tv += 1
if v.visibility == 2:
# and for collapsed graph
collapfile.write(v.unique_name+' '+str(v.lat)+' '+str(v.lng)+'\n')
v.c_vertex_num = cv
cv += 1

for v in mv:
# all vertices, for simple graph
simplefile.write(v.unique_name + ' ' + str(v.lat) + ' ' + str(v.lng) + '\n')
v.s_vertex_num = sv
sv += 1
# visible vertices
if v.visibility >= 1:
# for traveled graph
travelfile.write(v.unique_name + ' ' + str(v.lat) + ' ' + str(v.lng) + '\n')
v.t_vertex_num = tv
tv += 1
if v.visibility == 2:
# for collapsed graph
collapfile.write(v.unique_name + ' ' + str(v.lat) + ' ' + str(v.lng) + '\n')
v.c_vertex_num = cv
cv += 1

Would it save a noticeable amount of time to store & retrieve v.unique_name + ' ' + str(v.lat) + ' ' + str(v.lng) + '\n' rather than calculate it 3 times?

# printable string
def __str__(self):
return self.unique_name

doesn't appear to be used. We could repurpose it. Or not.

Activity

  1. yakra commented on Jan 21, 2023

    @yakra
    OwnerAuthor

    vstr is calculated for the master graph, and again for every subgraph.
    Store self.tmg_line upon construction and refer to that instead.

  2. reopened this on Jan 21, 2023
  3. yakra commented on Jan 29, 2023

    @yakra
    OwnerAuthor

    On second thought, naah.
    System monitor suggests this takes an add'l 71.9 MiB.
    tail -n +3 tm-master-simple.tmg | head -n 801850 | wc -c = 28,695,406, or 27.4 MiB.
    Add in 49 B per string container and that's 28695406 + 39290650 = 67986056, or 64.8 MiB.
    The remaining difference works out to 9B per -- 8 B to point to each object from the HGVertex + 1 more byte, well within margin of error at this point.

    But yeah no. I don't feel like this is worth wasting 71.9 MiB more over.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions