Welcome to the Onshape forum! Ask questions and join in the discussions about everything Onshape.
First time visiting? Here are some places to start:- Looking for a certain topic? Check out the categories filter or use Search (upper right).
- Need support? Ask a question to our Community Support category.
- Please submit support tickets for bugs but you can request improvements in the Product Feedback category.
- 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.
FeatureScript Profiler discussion
kevin_o_toole_1
Onshape Employees, Developers, HDM Posts: 565
Hey FeatureScript authors,
We're happy this week to have released the FeatureScript profiler, Onshape's tool for viewing timing data for individual execution steps inside your custom features (you can check out a quick video here or the documentation here).
We're already eating our own dogfood and using this tool to help speed up features in our standard library, but fundamentally, this was created to be a tool for the whole FeatureScript community. We hope it provides rapid feedback for FeatureScript authors, and helps improve performance in the wide variety of custom features floating around the Onshape ecosystem.
@jon_hirschtick likes to say "Testing makes fools of all of us", and in my experience that absolutely applies to profiling.
So, I ask you all, when looking at your timings, what has surprised you? What parts run slow, and what runs fast? What code changes have you made to successfully improve performance?
Happy scripting!
Kevin
We're happy this week to have released the FeatureScript profiler, Onshape's tool for viewing timing data for individual execution steps inside your custom features (you can check out a quick video here or the documentation here).
We're already eating our own dogfood and using this tool to help speed up features in our standard library, but fundamentally, this was created to be a tool for the whole FeatureScript community. We hope it provides rapid feedback for FeatureScript authors, and helps improve performance in the wide variety of custom features floating around the Onshape ecosystem.
@jon_hirschtick likes to say "Testing makes fools of all of us", and in my experience that absolutely applies to profiling.
So, I ask you all, when looking at your timings, what has surprised you? What parts run slow, and what runs fast? What code changes have you made to successfully improve performance?
Happy scripting!
Kevin
Tagged:
1
Comments
-
Hi @kevin_o_toole_1
Great feature and I'm sure I'll be using it soon.
You guys are probably way ahead of me but is it possible to use it with the native features too? I'd love to be able to see which features in my model take the longest time so that I could do my part to improve initial load and rebuild times.
Keep up the good work
Cheers, Owen S.
Business Systems and Configuration Controller
HWM-Water Ltd0 -
@owen_sparks Unfortunately, no, not yet. If we do extend the tool for that it will probably be connected but a lot less FeatureScript-centric, showing you a higher-level view without requiring the existence of a Feature Studio.
0 -
Actually you can run some tests to improve your rebuild times.
I have copied Onshape's FeatureScript code of Extrude and Thicken from the public document "std". You can merge this 2 FeatureScript into one, but I just have created 2 branchs in the document:- Extrude (36 ms) https://cad.onshape.com/documents/58e1abcdee7f970fe47eb60d/w/e87c6e8367495186288f7f0b/e/3f0d19e679bc131b56d16326
- Thicken (33 ms) https://cad.onshape.com/documents/58e1abcdee7f970fe47eb60d/w/65013b0fde29375b5566b0e2/e/7f3601973e0bdd20c419ade9
Un saludo,
Eduardo Magdalena C2i Change 2 improve ☑ ¿Por qué no organizamos una reunión online?
Partner de PTC - Onshape Averigua a quién conocemos en común0 -
Thanks guys, good stuff
Business Systems and Configuration Controller
HWM-Water Ltd0 -
Very nice indeed, this well help me shave those milliseconds off my builds."A common mistake that people make when trying to design something completely foolproof is to underestimate the ingenuity of complete fools." - Douglas Adams, Mostly Harmless0
-
Before everyone starts using "thicken" instead of "extrude", please keep in mind that the timing variability (see #1 in https://cad.onshape.com/FsDoc/debugging-in-feature-studios.html#profiling-tips) is significantly greater than the difference between 36ms and 33ms. If it was 100ms vs 30ms, that's one thing, but for such small differences, you have to regenerate many times to be sure that you're seeing a real timing difference and not a fluke.
@emagdalenaC2C
Ilya Baran \ VP, Architecture and FeatureScript \ Onshape Inc1 -
Of couse FeatureScrip profile should be used just to check the performance of different ways to do the same thing, but small differences should not be in consideration.
There is not much to win in 3 ms. Even in a FeatureScript without code like this, you get 30 ms:
FeatureScript 543;
import(path : "onshape/std/geometry.fs", version : "543.0");
annotation { "Feature Type Name" : "Extrude Light" }
export const extrudeLight = defineFeature(function(context is Context, id is Id, definition is map)
precondition
{
// Define the parameters of the feature type
}
{
// Define the function's action
});
However, in the image below you can see the result of the FeatureScript profile for a very complete FeatureScript that creates 32 cut extrudes on several solids and also creates 35 parts and 28 mate connectors in a single feature in a Part Studio.
FeatureScript profile will be of great help to reduce that 7.82 seconds and improve user experience.
Un saludo,
Eduardo Magdalena C2i Change 2 improve ☑ ¿Por qué no organizamos una reunión online?
Partner de PTC - Onshape Averigua a quién conocemos en común1



