Shawn:

I've asked if we are doing call load_catalogs and we are as below from the api.py. This takes huge amount of time if you have a lot of repositories with lots of packages. In your system it takes probably 2-3 seconds but it's still not efficient. If possible I would remove the load_catalogs from that function as other functions are doing that if necessary.

def get_publisher_last_update_time(self, prefix=None, alias=None):
        """Returns a datetime object representing the last time the
        catalog for a publisher was modified or None."""
        if alias:
                prefix = self.get_publisher(alias=alias).prefix
        dt = None
        self.__activity_lock.acquire()
        try:
                self.__set_can_be_canceled(True)
                try:
####################BELOW LINE######################################
                        self.img.load_catalogs(self.progresstracker)
######################################################################
                        dt = self.img.get_publisher_last_update_time(
                            prefix)
                except api_errors.CanceledException:
                        self.__reset_unlock()
                        raise
                except Exception:
                        self.__reset_unlock()
                        raise
        finally:
                self.__activity_lock.release()
        return dt


Shawn Walker wrote:
Michal Pryc wrote:
Hello,
I have identified why the startup of PM is so slow after changes:

def __get_publisher_timestamp(self, publisher):
        import time
        a = time.time()
        dt = self.api_o.get_publisher_last_update_time(prefix=publisher)
        print time.time() - a
        if dt:
                return dt.ctime()
        return dt

This result in:
bash-3.2$ pfexec python packagemanager.py
8.41350483894

Which means that we are loosing 8 seconds. Before this function took less then 0.0001.

That function does not take 8 seconds on my system. What's the output of "pkg publisher" ?

I might also add the function as it was before was also wrong; it was returning the time as UTC, not local to the system. But I don't see how that would add that much time to it.

So if it will be still so slow, we will need to revert back to using the old one.

We need to work out the performance issue then and why there is one.

Cheers,

_______________________________________________
pkg-discuss mailing list
[email protected]
http://mail.opensolaris.org/mailman/listinfo/pkg-discuss

Reply via email to