Community
Fusion API and Scripts
Got a new add-in to share? Need something specialized to be scripted? Ask questions or share what you’ve discovered with the community.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Speed of browse DataPanel from API

4 REPLIES 4
SOLVED
Reply
Message 1 of 5
-pezi-
335 Views, 4 Replies

Speed of browse DataPanel from API

Hi, I have a question about the loading speed of the active Hub structure using the API, specifically C ++. There are 10 projects in my HUB and the sum of all directories on the first level of these projects is 19. Retrieving information about these numbers is 16 s when using the FOR loop and 21 s when using the FOREACH loop.

I think both of these results are too long. Because when browsing these HUBs directly from the FUSIONI360 environment, the reactions are fast.

Is it okay or I'm making a mistake somewhere. Below is the code I use:

 

	app = Application::get();
	if (!app)
		return false;

	ui = app->userInterface();
	if (!ui)
		return false;

	system_clock::time_point timeOfStart = system_clock::now();

	int fol = 0, proj = 0;

	for (size_t i = 0; i < app->data()->activeHub()->dataProjects()->count(); i++)
	{
		proj ++;
		Ptr<DataProject> proj = app->data()->activeHub()->dataProjects()->item(i);
		for (size_t ii = 0; ii < proj->rootFolder()->dataFolders()->count(); ii++)
		{
			fol++;
		}
	}

	system_clock::time_point timeOfEnd = system_clock::now();

 

Labels (1)
4 REPLIES 4
Message 2 of 5
goyals
in reply to: -pezi-

Not sure if making the small adjustment in code as shown below speed up the performance by any value but may be worth to give a try. Thanks. 

	size_t projectsCount = app->data()->activeHub()->dataProjects()->count();
Ptr<DataProjects> projects = app->data()->activeHub()->dataProjects(); 
for (size_t i = 0; i < projectsCount; i++)
	{
		proj ++;
		Ptr<DataProject> proj = projects->item(i);
                size_t foldersCount = proj->rootFolder()->dataFolders()->count();
		for (size_t ii = 0; ii < foldersCount; ii++)
		{
			fol++;
		}
	}

 



Shyam Goyal
Sr. Software Dev. Manager
Message 3 of 5
-pezi-
in reply to: goyals

 

Thank you for your quick reply. Although code by your advice runs half of the time, still is non-useable for me, because loading full active HUB with 10 projects, 50 folders, 84 files with the max level of project three is almost one minute and this is too long.

Message 4 of 5
goyals
in reply to: -pezi-

Data API are inherently slow in nature because it make the REST API call to Fusion DM system to return the actual state of data when API is called. We are investigating how to improve these data API performance. Till then you can improve the performance to some extent by optimizing your code as I shown in my earlier reply. Thanks for posting your query.



Shyam Goyal
Sr. Software Dev. Manager
Message 5 of 5
-pezi-
in reply to: goyals

Ok, thank's for your reply, I acceptation the actual state, and I hope you find a way to improve data API performance soon.

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Technology Administrators


Autodesk Design & Make Report