but if you run the rebuild function in the main function, i guess before the callback, its super fast to build the 100 knobs. but then when you hit the rebuild function its getting slower with every knob you add.
is there a flag or something to exclude knobs from the knobChanged callback? 2015-02-21 0:12 GMT+01:00 Nathan Rusch <nathan_ru...@hotmail.com>: > In 8.0v6, I get consistent (albeit slow) performance in my own quick test, > averaging a fraction of a second for removal and about 5.5 seconds to add > 100 knobs, followed by maybe 4 seconds for Nuke to actually redraw the > panel. 9.0 seems to be slightly slower. Disabling undo doesn't make a > difference either. > > > class PerfTest(nukescripts.panels.PythonPanel): > def __init__(self): > super(PerfTest, self).__init__('PerfTest', 'something') > self.addKnob(nuke.PyScript_Knob('rebuild')) > self.boolKnobs = [] > > def knobChanged(self, knob): > if knob.name() == 'rebuild': > self.rebuild() > > def rebuild(self): > mark = time.time() > for k in reversed(self.boolKnobs): > self.removeKnob(k) > self.boolKnobs = [] > mark 2 = time.time() > print 'knob removal:', mark2 - mark > for i in xrange(100): > k = nuke.Boolean_Knob('bool_' + str(i)) > k.setFlag(nuke.STARTLINE) > self.addKnob(k) > self.boolKnobs.append(k) > print 'knob creation:', time.time() - mark2 > > > -Nathan > > > > From: michael vorberg > Sent: Tuesday, February 17, 2015 4:31 AM > To: Nuke Python discussion > Subject: [Nuke-python] nukescript panel add button > > > hi, > > i create a nukescript panel which creates a some (boolean) buttons for > nodes in my script. i filter these nodes in the panel via a user text input. > > if i start my panel it set a default filter and everything is fine and > fast. when i hit my update button, i execute a callback function > (knobChanged) and to delete all the create boolean knobs and search again > in the nuke script and create new knobs. > here everything gets slower over time, but i call the same functions as in > the startup. > > i guess it will now call the knobChanged callback for every knob i create > to look if they hit a condition in there. > > i messured the execution time in the functions and i can see clearly a > dramatic increase in the time taken to create the knobs. > > startup call: > > > search time: 0.00189313135161 > > clear list time: 2.67769610218e-06 > > list length 24 > > added knob time: 5.93556032982e-05 > > added knob time: 5.71241898797e-05 > > added knob time: 5.35539275006e-05 > > added knob time: 5.35539284101e-05 > > added knob time: 5.35539284101e-05 > > added knob time: 5.48927755517e-05 > > added knob time: 5.35539275006e-05 > > added knob time: 5.44464937775e-05 > > added knob time: 5.35539275006e-05 > > added knob time: 5.4446492868e-05 > > added knob time: 5.44464937775e-05 > > added knob time: 5.53390582354e-05 > > added knob time: 5.48927764612e-05 > > added knob time: 5.48927764612e-05 > > added knob time: 5.53390582354e-05 > > added knob time: 5.53390591449e-05 > > added knob time: 5.62316236028e-05 > > added knob time: 5.6677907196e-05 > > added knob time: 8.30085882626e-05 > > added knob time: 5.04299487147e-05 > > added knob time: 5.13225149916e-05 > > added knob time: 5.08762313984e-05 > > added knob time: 4.9983666031e-05 > > added knob time: 5.17687967658e-05 > > total knob time: 0.00277811001069 > > > > update call: > > search time: 0.00190384213693 > > clear list time: 3.12397969537e-06 > > list length 24 > > added knob time: 0.0111396632883 > > added knob time: 0.0114480446564 > > added knob time: 0.0120420469739 > > added knob time: 0.0123955028985 > > added knob time: 0.0129551414448 > > added knob time: 0.0135629785273 > > added knob time: 0.0142319563429 > > added knob time: 0.0150205379314 > > added knob time: 0.0158385741797 > > added knob time: 0.0169823968236 > > added knob time: 0.0177259038564 > > added knob time: 0.0187371805287 > > added knob time: 0.0198203087202 > > added knob time: 0.0210083133543 > > added knob time: 0.0222213098223 > > added knob time: 0.0236030011629 > > added knob time: 0.0248650887297 > > added knob time: 0.0262856066684 > > added knob time: 0.0277529842924 > > added knob time: 0.0292618662115 > > added knob time: 0.0308528641535 > > added knob time: 0.0329334342532 > > added knob time: 0.0344815890521 > > added knob time: 0.0362542240655 > > > > total knob time: 0.502958408235 > > > > if i have around 100 nodes in my list, the time for the last knobs is over > 0.5 seconds. > > > > is there something i can do to prevent that? > > > > > > > > > > > > _______________________________________________ > Nuke-python mailing list > Nuke-python@support.thefoundry.co.uk, http://forums.thefoundry.co.uk/ > http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python > _______________________________________________ > Nuke-python mailing list > Nuke-python@support.thefoundry.co.uk, http://forums.thefoundry.co.uk/ > http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python >
_______________________________________________ Nuke-python mailing list Nuke-python@support.thefoundry.co.uk, http://forums.thefoundry.co.uk/ http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python