Performance issue

Dec 20, 2010 at 2:02 PM

Hi, I got a performace issue when I wanted to create my own scrum. 

In my scrum project I have three work items  (Persona,Activity,Product Blog Item). The logic is that when I choose a Persona it will show all the Activities which related to the Persona and show all the PBIs which both related to Activity and Persona.  

Now, I follow the steps below: 

1, Get all the PBIs by the project name. 

2,Query the related links of each PBI, create a new work item by the link id and find out which work item type the related work item belongs to.If the related work items contains the current activity and persona, it means that the PBI is needed to be shown on the page. 

The problem focus: 

As you know, there will be thousands of PBIs in a project, it will take long time to do the loop in step 2 above.

I will paste my code if it would help you guys to understand the issue I am facing with. 

Look forward to reply.  thanks,


Dec 30, 2010 at 1:15 PM

TFS 2010 allows you to express link relations in the query:

Dec 31, 2010 at 7:21 AM

thank you Perb.

but I now use tfs 2008 to develop. I installed vs2010 as you know it will install tfs2010 automatically,but I found there are no related dlls such as Microsoft.TeamFoundation.WorkItemTracking.Client.dll in vs 2010.

So how can I continue?

thank you

Jan 3, 2011 at 2:05 PM

The client for 2010 should be available in

C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\PrivateAssemblies

But it won't help you of course if you don't access a TFS2010 server.

Jan 4, 2011 at 2:35 AM
Edited Jan 4, 2011 at 3:03 AM

Thank you Perb,Hope you have a happy new year.

Now I have changed the process logic, please help me take a look. Following is the process and the execute time

1, Get the Projects, it takes 0.4 second.

2, Get Persona as per Project . it takes 5.3 seconds.

3, Get activities and PBIs by current Persona. It takes 32 seconds.(in fact, there are only 6 activities and 20 PBIs related to the persona). I used the code as following:

foreach (Link l in personaWi.Links)


if (l is RelatedLink)


WorkItem wi = GetWorkItem(((RelatedLink)l).RelatedWorkItemId);

 if (wi.Type.Name == "Product Backlog Item")


ProductBacklogItem pbi = ObjectFactory.CreateProductBacklogItem(wi);



else if (wi.Type.Name == "Activity Item")


ActivityBackboneItem ai = ObjectFactory.CreateActivityBackboneItem(wi);





4.Judge whether the activity is linked to multiple personas. it takes 39 seconds.(because I need to add a icon to this kind activity)

5,Judge whether the PBI is linked to multiple activities. it takes 50 seconds.(because I need to add a icon to this kind PBI)

6, when I changed the propery of the PBI, I need to judge whether it is changed or not by the revision of the PBI, it takes 7 seconds.

I have a TFS2008 server in a romote machine, so how can I lessen time for the whole process.

any suggestions are appreciated.

PS: I found it was caused because I call the method frequently, each call takes more than 1 second.

WorkItem wi = GetWorkItem(((RelatedLink)l).RelatedWorkItemId);









Jan 17, 2011 at 9:37 PM

It's kind of hard to optimize logic where you have to check links in TFS2008, the only optimization I know of is preloading all work items matching the query and then do the check with RelatedWorkItem in memory instead. Listing 20 items is of course much faster that calling GetWorkItem 20 items.