javamacosjythonjnotify

JNotify jython too slow on OS X 10.8.5


I have some jython code with JNotify, like this:

mask = JNotify.FILE_CREATED | JNotify.FILE_DELETED | \
      JNotify.FILE_MODIFIED | JNotify.FILE_RENAMED

class Listener(JNotifyListener):

    def fileRenamed(self, wd, rootPath, oldName, newName):
        pass

    def fileModified(self, wd, root, name):
        add_file(root, name)

    def fileDeleted(self, wd, root, name):
        add_file(root, name)

    def fileCreated(self, wd, root, name):
        add_file(root, name)

st = time.time()
JNotify.addWatch("some_path", mask, True, Listener())
print time.time - st

It costs about 98.4 seconds to complete the code.

But when I run time java -jar jnotify-0.94.jar command, it is very fast and costs less than 1 second.

What's wrong with Jython and JNotify?


Solution

  • the time is related with the count of files. NOT Jython or JNotify's problem. !-_-