> For the complete documentation index, see [llms.txt](https://bimwhale.gitbook.io/ifc-js/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://bimwhale.gitbook.io/ifc-js/additional-notes/improve-performance.md).

# Improve Parsing Performance

I did some changes to increase performance.

## Remove findRemainingTypes()

{% code title="src/ifc-parser/ifc-services/ifc-processor.js" %}

```javascript
function loadIfcFileItems(ifcData) {
   const ifcItems = readIfcItems(ifcData);
   // findRemainingTypes(ifcItems);
   return loadItems(ifcItems);
 }
```

{% endcode %}

## Check isArray once

I moved the `isArray` outside the loop. This a dirty trick... but it should work.

{% code title="src/ifc-project-builder/ifc-elements-binder.js" %}

```javascript
function bindElements(finder, type, relating, related, property) {
    const relations = finder.findByType(type);
    if (Object.keys(relations).length === 0) return;
    const _isArray = isArray(Object.keys(relations)[0]);
    Object.values(relations).forEach((relation) => {
          return _isArray
                ? bindMultiple(relation, relating, related, property)
                : bindSingle(relation, relating, related, property);
    });
}
```

{% endcode %}

## getName once

I moved the `getName` outside the loop. This will improve performance for large files.

{% code title="src/ifc-project-builder/items-finder.js" %}

```javascript
findByType(ifcType) {
    const matches = {};
    const name = getName(ifcType);
    Object.keys(this.ifcData).forEach((e) => {
        if (this.getType(e) === name) {
            matches[e] = this.ifcData[e];
        }
    });
    return matches;
}
```

{% endcode %}

## Const instead of var

When we target modern browser, Babel will use `const` instead of `var`.  I saw a \~4 second increase with the [IFC Sample File](/ifc-js/introduction/ifc-sample-file.md).&#x20;
