Closed nissansz closed 2 years ago
It takes as long as it takes I'm afraid.
It's possible you're running into a bug, but if so it's unlikely to be fixed. I'm no longer actively working on this project because SWF is obsolete, so it seems a bit pointless. I am accepting patches, though.
Thank you for your reply. Is the bottleneck in read file or dumping?
// open files
std_in = !strncmp(infile, "stdin", 5);
std_out = !strncmp(outfile, "stdout", 6);
in_fp = std_in ? stdin : fopen(infile, "rb");
if (!in_fp) {
fprintf(stderr,"ERROR: could not open file %s for reading\n", infile?infile:"stdin");
goto fail;
}
how to use stdin or stdout for swf2xml? Is stdin faster than normal in?
The slowest part is most likely the actual conversion. I'm not honestly sure why it's slow as I didn't write the original code, my role has just been to apply bug fixes and other patches over the years. In principle swf2xml should be quite fast but... yeah, it isn't.
The main bottleneck that I'm aware of is that swfmill loads the entire SWF file into memory, and only then performs the conversion to XML (by constructing an XML DOM, in memory), and only then writes the completed XML document to disk (or stdout). It would be faster to perform all these tasks simultaneously: perform the conversion while the SWF file is being read, and as the conversion progresses generate and write out the XML using a streaming XML generator. Modifying swfmill to work that way is possible but would involve rewriting a large amount of it.
It might be worth reading from stdin if you're generating the SWF in some other tool, or downloading it from the network before passing through swfmill, but except in pathological cases the gains are going to be marginal at best. The option to read from stdin exists more for convenience than anything.
An example of how you might download a SWF from the web and pass it directly to swfmill through stdin:
curl 'http://example.org/example.swf' | swfmill swf2xml stdin output.xml
Depending on what you're trying to do you might have more luck with swftools, which can be used for similar tasks to swfmill and is quite a bit more mature.
Thank you. I managed to pass it to python multiprocess. It seems faster.
any method to accelerate swf2xml conversion? The command line seems slow in Win 10. steve8000818@gmail.com