Erotemic / ibeis

image based ecological information system
Apache License 2.0
49 stars 17 forks source link

Efficiency of Special Encounters #18

Closed Erotemic closed 2 years ago

Erotemic commented 10 years ago

It would be nice to do some special casing of the "special" encounters because currently one of the main delays in startup time is deleting and then reading all the image-encounter relationships.

File: ibeis\control\IBEISControl.py Function: add_encounters at line 725 Total time: 0.379971 s

Line # Hits Time Per Hit % Time Line Contents

725 @adder 726 def add_encounters(ibs, enctext_list): 727 """ Adds a list of names. Returns their nids """ 728 6 27 4.5 0.0 if utool.VERBOSE: 729 print('[ibs] adding %d encounters' % len(enctext_list)) 730 # Add encounter text names to database 731 6 57 9.5 0.0 notes_list = [''] * len(enctext_list) 732 31 3846 124.1 0.3 encounter_uuidlist = [uuid.uuid4() for in xrange(len(enctext_list))] 733 6 28 4.7 0.0 colnames = ['encounter_text', 'encounter_uuid', 'encounter_note'] 734 6 40 6.7 0.0 params_iter = izip(enctext_list, encounter_uuid_list, notes_list) 735 6 77 12.8 0.0 get_rowid_from_uuid = partial(ibs.get_encounter_eids_from_text, ensure=False) 736 737 6 1261676 210279.3 99.7 eid_list = ibs.db.add_cleanly(ENCOUNTER_TABLE, colnames, params_iter, get_rowid_from_uuid) 738 6 30 5.0 0.0 return eid_list

File: ibeis\control\IBEISControl.py Function: set_image_enctext at line 780 Total time: 0.567254 s

Line # Hits Time Per Hit % Time Line Contents

780 @setter 781 def set_image_enctext(ibs, gid_list, enctext_list): 782 """ Sets the encoutertext of each image """ 783 3 15 5.0 0.0 if utool.VERBOSE: 784 print('[ibs] setting %r image encounter ids' % len(gid_list)) 785 3 870500 290166.7 46.1 eid_list = ibs.add_encounters(enctext_list) 786 3 1019138 339712.7 53.9 egrid_list = ibs.add_image_relationship(gid_list, eid_list) 787 3 18 6.0 0.0 del egrid_list

File: ibeis\control\IBEISControl.py Function: delete_encounters at line 1948 Total time: 0.594904 s

Line # Hits Time Per Hit % Time Line Contents

1948 @deleter 1949 def delete_encounters(ibs, eid_list): 1950 """ Removes encounters (images are not effected) """ 1951 3 11 3.7 0.0 if utool.VERBOSE: 1952 print('[ibs] deleting %d encounters' % len(eid_list)) 1953 3 32245 10748.3 1.6 egrid_list = utool.flatten(ibs.get_encounter_egrids(eid_list)) 1954 3 737463 245821.0 37.2 ibs.db.delete_rowids(EG_RELATION_TABLE, egrid_list) 1955 3 1212060 404020.0 61.2 ibs.db.delete_rowids(ENCOUNTER_TABLE, eid_list)

Erotemic commented 2 years ago

stale