Welcome to the Onshape forum! Ask questions and join in the discussions about everything Onshape.

First time visiting? Here are some places to start:
  1. Looking for a certain topic? Check out the categories filter or use Search (upper right).
  2. Need support? Ask a question to our Community Support category.
  3. Please submit support tickets for bugs but you can request improvements in the Product Feedback category.
  4. Be respectful, on topic and if you see a problem, Flag it.

If you would like to contact our Community Manager personally, feel free to send a private message or an email.

Wildly varying regen times with instantiate

joshtargo
joshtargo Member Posts: 655 EDU

I've got a feature that instantiates configured geometry from Part Studios in previous Version of the same doc. Three addInstance calls into one instantiator, then a single instantiate.

Regen times swing by roughly 8x and I haven't been able to find a repeatable pattern.

What I'm seeing

Regen lands at either ~200ms or ~25ms, with very little in between. The same feature producing identical geometry will sit at one number or the other depending on what I did immediately before, and I can't predict which.

Some things that seem to matter, though none of them hold consistently:

  • Scrubbing the numeric inputs around and returning to a value often drops the time to the low number, but not always.
  • Committing the feature and reopening tends to help, but not always.
  • Suppressing and unsuppressing seems to reliably drop it to ~25ms without touching any input.

That last one is the part I find strangest — same parameters, nothing edited, and the cost disappears. So whatever the expensive work is, the re-entry path skips it and the first-touch path doesn't.

There's clearly some caching involved, but I've had trouble characterizing its scope. It isn't global across documents — a set of values that's fast in one document costs full price in a fresh one. Within a document it's shared between multiple instances of the feature. Beyond that I've had results that contradict each other.

What I've ruled out

  • Not my authoring workspace. Same behavior in a clean document with the feature inserted normally.
  • Not the dialog. Times are the same whether the dialog is open or committed.
  • Not document reload or tab switching. Neither changes anything.

Questions

  1. Is cost like this expected for instantiate against a configured source studio, or does 200ms suggest something inefficient on my end?
  2. What actually gets cached, and at what scope? I'd like to understand what a real user experiences versus what I see while iterating.
  3. Would opMergeContexts behave differently, or is the cost in regenerating the source studio at the configuration — in which case the transfer mechanism wouldn't matter?
  4. Anything I can do from the feature side to reduce first-hit cost?