简体   繁体   English

在OS X 10.8.5上JNotify jython太慢

[英]JNotify jython too slow on OS X 10.8.5

I have some jython code with JNotify, like this: 我在JNotify中有一些jython代码,如下所示:

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. 完成代码大约需要98.4秒。

But when I run time java -jar jnotify-0.94.jar command, it is very fast and costs less than 1 second. 但是,当我运行time java -jar jnotify-0.94.jar命令时,它非常快并且花费不到1秒。

What's wrong with Jython and JNotify? Jython和JNotify有什么问题?

the time is related with the count of files. 时间与文件数有关。 NOT Jython or JNotify's problem. 不是Jython或JNotify的问题。 !-_- !-_-

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM