Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

JSON.parse extremely slow in ExtendScript

Enthusiast ,
Jan 27, 2023 Jan 27, 2023
We're sending a large JSON dataset (7mb of data) from a Panel Extension front end to ExtendScript
 
JS Context

 

dataSet = JSON.stringify(dataSet);
dataSet = encodeURIComponent(dataSet);
extendScriptFunction = `extendScriptFunction('${dataSet}')`;
csInterface.evalScript(extendScriptFunction, extendScriptReturn => {
	//Handle extendScriptReturn
	//Just for reference...
	dataSet = decodeURIComponent(dataSet);  // Takes 19ms
	dataSet = JSON.parse(dataSet); // Takes 25ms
});

 

 
ExtendScript Context

 

//Note: 7mb dataSet arrives to ExtendScript quickly, no problem
extendScriptFunction = function(dataSet){
	dataSet = decodeURIComponent(dataSet); // Takes 199ms
	dataSet = JSON.parse(dataSet); // Takes 143314ms -- 2 minutes!!!
}

 

 
So for some reason ExtendScript's JSON.parse is sluggish
Wondering if there's a solution for this.
TOPICS
Error or problem , Freeze or hang , Performance , SDK
1.2K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Adobe Employee , Jan 27, 2023 Jan 27, 2023

None of which I'm aware; you're the first to report the issue. 

Note: The JSON object available through PPro's ExtendScript API, is provided by, and contingent on the visibility of, the CC Libraries panel. 

Since you can't trust that every user will always have the Libraries panel open, many panels rely on Douglas Crockford's json2.js.

Translate
Adobe Employee ,
Jan 27, 2023 Jan 27, 2023

None of which I'm aware; you're the first to report the issue. 

Note: The JSON object available through PPro's ExtendScript API, is provided by, and contingent on the visibility of, the CC Libraries panel. 

Since you can't trust that every user will always have the Libraries panel open, many panels rely on Douglas Crockford's json2.js.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Jan 27, 2023 Jan 27, 2023

@Bruce Bullis Thanks for the insight.  I was on the hunt for possible JSON libraries that by some miracle might perform better and came across the same library but at a different link.  Just tried the library you linked to as well, and so far the 'great Crockford hope' isn't doing the trick.

 

I think the test we used is pretty definitive:

startTime = new Date().getTime();
dataSet = JSON.parse(dataSet);
endTime = new Date().getTime();
trt = endTime - startTime;

We're getting much better results on an M1 (7mb of data parsed in 2.5 minutes)

vs an intel Mac (same 7mb of data parsed in 12 minutes)

(That Mac is on the east coast, so maybe we can blame that 🤪) 

 

Have you tested parsing a 7mb dataset in ExtendScript and seen it handle it at more-or-less browser JS speed?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Employee ,
Jan 27, 2023 Jan 27, 2023

Have you tested parsing a 7mb dataset in ExtendScript and seen it handle it at more-or-less browser JS speed?

I've never attempted that, and have no reason to doubt your results. 

I presume you're running your ExtendScript from within a CEP panel(?); perhaps you could do the JSON processing via JavaScript (in CEP), rather than in ExtendScript? 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Jan 27, 2023 Jan 27, 2023

I presume you're running your ExtendScript from within a CEP panel(?)


Yes

 


perhaps you could do the JSON processing via JavaScript (in CEP), rather than in ExtendScript? 

We actually pare down the data on the JS side to send a minimal amount to ExtendScript.

Any idea why ExtendScript should have trouble with a JSON.parse?

I might try an approach that doesn't require JSON.parse as alternate or otherwise get creative with how the data is sent.  

(Maybe this is a good time to re-ask if UXP by chance is coming to Premiere?)

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Employee ,
Jan 27, 2023 Jan 27, 2023

>Any idea why ExtendScript should have trouble with a JSON.parse?

None, sorry. 

Maybe this is a good time to re-ask if UXP by chance is coming to Premiere?

Yes! We are currently working on providing support for PPro extensibility via UXP. No dates available. 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Jan 27, 2023 Jan 27, 2023

Need any beta testers?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Employee ,
Jan 27, 2023 Jan 27, 2023

Once 3rd party UXP extensibility is available in PPro beta builds, we will definitely want lots of testers. Don't worry, we'll announce that availability, loudly and broadly. 🙂

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Jan 27, 2023 Jan 27, 2023
LATEST

Looking forward to it!

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines