Speed of browse DataPanel from API

Speed of browse DataPanel from API

-pezi-
Enthusiast Enthusiast
906 Views
4 Replies
Message 1 of 5

Speed of browse DataPanel from API

-pezi-
Enthusiast
Enthusiast

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();

 

Accepted solutions (1)
907 Views
4 Replies
Replies (4)
Message 2 of 5

goyals
Autodesk
Autodesk

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
0 Likes
Message 3 of 5

-pezi-
Enthusiast
Enthusiast

 

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.

0 Likes
Message 4 of 5

goyals
Autodesk
Autodesk
Accepted solution

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
0 Likes
Message 5 of 5

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