On 07/16/2009 05:39 PM, Rob Antonishen wrote: > I have a (hopefully simple) question that I can not seem to find the > answer for anywhere... > > When is it appropriate to write: > > - a script > - a python plugin > - a compiled plugin > > Specifically, If I have written a script and want better speed, should > I write it as a python plugin, or as a C plugin? The first thing you should do is to benchmark your current plug-in, what exactly is slow? The algorithm you use? Then switching language won't help. Is it the manipulation of individual pixels that is slow? Then switching to C might help as it enables you to be more clever about memory and CPU usage. > Looking at the examples provided on C plugins (or at the code for > these plugins themselves), they mostly seem to work at a low level, on > a drawable/pixel. Would there be any advantage to a C plugin that > just combines other PDB functions? No not that I can see, if all you do is invoke other procedures in the PDP, C is a bad language choice. One slight drawback of plug-ins written in Python is that it is not trivial to get Python working on a Windows install. > Here is an example. I want to make a drop shadow based on the alpha > of a layer or a selection, with an offset, direction, colour and > hardness....but want a preview for the user to see what their choices > are doing. The current script infrastructure is terrible for doing live previews, IMHO you should help getting GEGL integrated instead so that we can do this in a proper way. This could be done by pdb calls to duplicate layers, lock > alpha, fill, blur, translate, etc. without having to access the pixel > data of an image itself. I could do it with a script, but get no > preview. I could do it with a python plugin, but still wouldn't get a > preview (though I have read the the preview window widget is > supported, I can't get it to work and have seen no example), or I > could write it as a C plugin. But as a C plugin it would just be a > bunch of calls to gimp_run_procedure? Does this make sense to do? > Would any speed improvement be worth it? Again, if all you do is invoke other procedures, C won't give you any notable performance improvement as most of the processing will occur in the GIMP core anyway. HTH, / Martin _______________________________________________ Gimp-developer mailing list Gimp-developer@xxxxxxxxxxxxxxxxxxxxxx https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-developer