gnome-prototypes-team / gnome-music

Gnome Music
https://live.gnome.org/Music
Other
5 stars 13 forks source link

album widget: get_publication date takes too long #111

Closed vrutkovs closed 11 years ago

vrutkovs commented 11 years ago
File: ./gnomemusic/widgets.py
Function: update at line 166
Total time: 0.003667 s

Line #      Hits         Time  Per Hit   % Time  Line Contents
==============================================================
   166                                               @profile
   167                                               def update(self, artist, album, item, header_bar, selection_toolbar):
   168         1            6      6.0      0.2          self.selection_toolbar = selection_toolbar
   169         1            3      3.0      0.1          self.header_bar = header_bar
   170         1         2364   2364.0     64.5          released_date = item.get_publication_date()
sumansai14 commented 11 years ago

I think we don't need to use get_publication_date since it has become redundant. get_creation_date sets the "released-label-info" and takes less time than get_publication_date does.

   209         1          208    208.0      2.2          self.ui.get_object("artist_label").set_markup(escapedArtist)
   210         1           73     73.0      0.8          self.ui.get_object("title_label").set_markup(escapedAlbum)
   211         1          216    216.0      2.3          if (item.get_creation_date()):
   212         1           30     30.0      0.3              self.ui.get_object("released_label_info").set_text(
   213         1          255    255.0      2.7                  str(item.get_creation_date().get_year()))
   214                                                   else:
   215                                                       self.ui.get_object("released_label_info").set_text("----")
   216         1           26     26.0      0.3          self.player.connect('playlist-item-changed', self.update_model)