Starting with version 6.0.442, calling 'IsTypedBy' for IIfcElement takes significantly more time when working with relatively large models.
I prepared simple projects with similar console applications, but different versions of xbim as dependencies.
IsTypedByRegressionCheck.zip
How to reproduce:
- Download and open the attached solution in Visual Studio.
- Set Example_5_1_341 as the startup project.
- In the project settings (Debug section), add the path to the IFC file to the command line arguments. (e.g., NBU_MedicalClinic_Eng-MEP.ifc from this link).
- Run the project.
- Set Example_6_0_442 as the startup project.
- Add the same IFC file path to the command line arguments for this project.
- Run the project.
- Compare the results.
Example output:
Hello xbim!
Example_5_1_341, file name: NBU_MedicalClinic_Eng-MEP.ifc
ifc store ready
total elements count: 16012
elements with type count: 16012
open store time: 12.2334502
process elements time: 0.06461
Hello xbim!
Example_6_0_442, file name: NBU_MedicalClinic_Eng-MEP.ifc
ifc store ready
total elements count: 16012
elements with type count: 16012
open store time: 34.6255213
process elements time: 14.0791487
As of my results from my laptop it was 0.06461 s in project with dependency on xbim 5.1.341 against 14.0791487 s in project with dependency on xbim 6.0.442
As of my tests with updated xbim - newer versions of xbim performing in relative same time as 6.0.442
Here is code from attached project just in case
public class Program
{
public static void Main(string[] args)
{
Console.WriteLine("Hello xbim!");
Console.WriteLine(string.Format("Example_5_1_341, file name: {0}", Path.GetFileName(args[0])));
string filePath = args[0];
Stopwatch openStoreStopwatch = new Stopwatch();
Stopwatch processElementsStopwatch = new Stopwatch();
openStoreStopwatch.Start();
using (IfcStore ifcStore = IfcStore.Open(args[0]))
{
openStoreStopwatch.Stop();
Console.WriteLine("ifc store ready");
using (var inverseCache = ifcStore.BeginInverseCaching())
{
processElementsStopwatch.Start();
var elements = ifcStore.Instances.OfType<IIfcElement>().ToList();
int typedElementsCount = 0;
Console.WriteLine(string.Format("total elements count: {0}", elements.Count));
foreach (var element in elements)
{
var typedDefault = element.IsTypedBy.FirstOrDefault();
if (typedDefault == null || typedDefault.RelatingType == null
|| typedDefault.RelatingType.Name == null || !typedDefault.RelatingType.Name.HasValue)
{
continue;
}
typedElementsCount++;
}
processElementsStopwatch.Stop();
Console.WriteLine(string.Format("elements with type count: {0}", typedElementsCount));
}
}
Console.WriteLine(string.Format("open store time: {0}", openStoreStopwatch.Elapsed.TotalSeconds.ToString()));
Console.WriteLine(string.Format("process elements time: {0}", processElementsStopwatch.Elapsed.TotalSeconds.ToString()));
}
}
Starting with version 6.0.442, calling 'IsTypedBy' for IIfcElement takes significantly more time when working with relatively large models.
I prepared simple projects with similar console applications, but different versions of xbim as dependencies.
IsTypedByRegressionCheck.zip
How to reproduce:
Example output:
As of my results from my laptop it was 0.06461 s in project with dependency on xbim 5.1.341 against 14.0791487 s in project with dependency on xbim 6.0.442
As of my tests with updated xbim - newer versions of xbim performing in relative same time as 6.0.442
Here is code from attached project just in case