firefox addon - nsIProperty.get to something other than nsIFile - fastest way to get special path strings -
firefox addon - nsIProperty.get to something other than nsIFile - fastest way to get special path strings -
is possible utilize nsiproperty.get special path other nsifile? tried nsisupportsstring doesnt work. there's gotta other nsifile should on right, why else create argument?
im looking fastest way special path strings, because stuff happening on 200ms animation of panel element these times critical me.
heres speed analysis:
// fileutils.jsm :: getfile // average time: 3.85ms console.time('path'); var path = fileutils.getfile('defprofrt', []).path; console.timeend('path'); console.log(path); // nsidirectoryservice :: nsiproperties :: - nsifile // average time: 0.07ms console.time('path'); var path = cc["@mozilla.org/file/directory_service;1"].getservice(ci.nsiproperties).get('defprofrt', ci.nsifile).path; console.timeend('path'); console.log(path); // os.constants.path // average time: 0.12ms console.time('path'); var path = os.constants.path.profiledir; console.timeend('path'); console.log(path);
i don't why os.constants.path takes longer nsiproperties.get os.constants.path hardcoded thought.
all 3 ways end same native code, nsidirectoryservice
approach involves less javascript other two.
you can't faster, nsifile not bottleneck here since no filesystem operation occurs. simply string concatenation.
if 0.07ms not enough, 're doing wrong.
firefox-addon
Comments
Post a Comment