Skip to main content
Question

My plugin runs 4 times slower in release than in development

  • June 5, 2025
  • 1 reply
  • 22 views

10x HTML

Hi, everything is in the title,

by release, i mean when executing the public plugin which is available to everyone,
and by development, i mean my local copy.
I have tested it on the exact same file and conditions, so i know it’s not related to something else.

Do you know about that ?
What could be the possible reasons ?
 

It seems to be the case in any context, in development, a complete re-render of my algorithm would take 0.5 to 1 sec in average, and it takes from 2 to 3 sec in release.

For context, my plugin is  :


https://www.figma.com/community/plugin/1504087347056471789/10x-html-design-to-clean-responsive-code-10x-faster
an HTML exporter that runs vert fast,
It is a big problem because my plugin shows a preview which allow for a WISIWIG live editing that has to re-render everything at every changes, and it’s only nice to use if the refresh time is below 1 sec.

Thanks.

1 reply

10x HTML
  • Author
  • New Member
  • 1 reply
  • June 6, 2025

Ok i have narrowed down the issue,

It is extremely surprising because the piece of code that runs slower is actually 150x slower in the release context, and doesn’t involve any api call

In order to get a fingerprint on some exported nodes, i run a hash on the bytes,
i turn the Uint8array to a string, then run the following that string: 

let ch:number;
for(let i = 0; i < len; i++) {
		ch = str.charCodeAt(i);
		h1 = Math.imul(h1 ^ ch, 2654435761);
		h2 = Math.imul(h2 ^ ch, 1597334677);
}

In my benchmark, those lines are called 3 times,  with str being of length : 3784881, 103060, 3055 (so up to a length of 4 millions basically)

in development context, those 3 calls takes 16ms
in release context, they take 2463ms (150x slower)

Is there a reason about the javascript execution context that could explain this huge difference ?

Please let me know, i really need a way to improve on this.
Cheers


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings