Skip to content

Commit

Permalink
config-autogen: generate sort operation outside for loop
Browse files Browse the repository at this point in the history
List operations in scale tests are inefficient due to incorrect
position of sort call.

Change-Id: Id695a55a48945806cd477a1520731f45fb691c56
Closes-Bug: #1416089
(cherry picked from commit 74b8b44)
  • Loading branch information
Hampapur Ajay committed Jan 30, 2015
1 parent 600537a commit fc5fb97
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions ifmap_frontend.py
Expand Up @@ -3227,10 +3227,10 @@ def _generate_cassandra_db_impl(self, gen_fname, gen_type_pfx):
write(gen_file, " unsorted_fq_names_uuids.append({'fq_name': child_fq_name, 'uuid': child_uuid,")
write(gen_file, " 'tstamp': tstamp})")
write(gen_file, "")
write(gen_file, " # sort children; TODO do this based on schema")
write(gen_file, " sorted_children = sorted(unsorted_fq_names_uuids, key = itemgetter('tstamp'))")
write(gen_file, " # re-write result's children without timestamp")
write(gen_file, " children_fq_names_uuids = [(child['fq_name'], child['uuid']) for child in sorted_children]")
write(gen_file, " # sort children; TODO do this based on schema")
write(gen_file, " sorted_children = sorted(unsorted_fq_names_uuids, key = itemgetter('tstamp'))")
write(gen_file, " # re-write result's children without timestamp")
write(gen_file, " children_fq_names_uuids = [(child['fq_name'], child['uuid']) for child in sorted_children]")
write(gen_file, " if back_ref_uuids:")
write(gen_file, " # go from anchor to backrefs")
write(gen_file, " obj_uuid_cf = self._obj_uuid_cf")
Expand Down

0 comments on commit fc5fb97

Please sign in to comment.