2 Replies Latest reply on May 16, 2015 10:48 PM by matias.kiviniemi

    My plugin on mac and on windows works different. Why?

    василийг84001771

      Hi!

       

      I'm writing a PS Plugin and I see that it's working different on mac and on windows. Can anybody explain why?

      More about it:

      I create new text layer and style it. Then I push button on my plugin which run script. This script gets json data with a list of texts from server. Then it iterates through this list and doing next:

      - Creates a duplicate of existing styled layer;

      - Changes text of duplicated layer to text from my list;

      - Saves this layer as PNG image.

      - Sends this image to server.

      - Deletes image.

      This process repeats for each text in list. And after ask for another batch of json data from server.

       

      I've tested this on Mac OS and on Windows machines. And result time for mac was 2-4 times bigger then time on windows.

        • 1. Re: My plugin on mac and on windows works different. Why?
          c.pfaffenbichler Level 9

          Do you really mean a plugin or do you mean a Script?

          Even if you should be talking about a Script but do not feel like posting the code it might be difficult to try and help you.

          And if you are talking a bout a plugin (C++ or whatever) this may not be the ideal Forum for addressing the issue.

          • 2. Re: My plugin on mac and on windows works different. Why?
            matias.kiviniemi Level 3

            It might "be a feature" if the outcome is the same on both.. My experience is that Javascript performance is pretty equal in Win & Mac (latter being slightly better). But there might be specific things that perform very differently. You should drill down on the difference, is everything slower or just some specific spot. If you find specific part that has a big difference, post it back here.

             

            A couple of pointers that might or might not be relevant (since you might be doing going through all layers):

            • The "collection.length" is not actually a variable but counts the lenght in real time every time it's called. So always when iterating through a collection, store length in local variable and don't do a "for (var i=0; i<collection.length; i++)"
            • It's faster to use foo.layers than foo.artLayers or foo.layerSets. If you just want to iterate art layers, you should still use .layers and add an if to chekc if it's an art layer