---
tagName: 8.6.0
name: 'data.RecordFactory: performance boost for creating records'
publishedAt: '2025-01-21T16:03:31Z'
isPrerelease: false
isDraft: false
---
# data.RecordFactory: performance boost for creating records

old version:
<img width="459" alt="Screenshot 2025-01-19 at 15 25 04" src="https://github.com/user-attachments/assets/5b58c5e7-51b7-42fc-9ec6-28b3b77b83e9" />

new version:
<img width="469" alt="Screenshot 2025-01-19 at 15 25 47" src="https://github.com/user-attachments/assets/6801ed21-a3b1-422c-98ff-a936d54b710d" />

While it is definitely not "best practises" to create massive amounts of records inside your UI at once (you would pull ranges from a backend), a framework should handle it as fast as possible.

To get the numbers up this drastically, I needed to move the fields creation outside of the record constructor and into the class generation. The API for records is the same as before, however the internal structure how data gets stored did change.

For nested data, you can change specific leaf nodes without overriding other siblings (it will get merged):
```
record.set({user: {firstname: 'Tobias'}})
```

You can also still trigger bulk updates => multiple fields getting into the same update cycle:
```
record.set({user: {firstname: 'Tobias', lastname: 'Uhlig'}})
```

You can still use the shortcut around the set() API to change root level fields, but this can no longer work for nested fields directly. Examples:

```
record.country = 'Germany'; // Internal setter, will trigger a change event like before

// No longer supported!
record.annotations.selected = false; // this shortcut syntax did work in previous versions, but no longer matches the internal structure

// Instead use the API:
record.set({annotations: {selected: false}})

// In case you want a direct field access to trigger the field change event, you can also use this shortcut (outside the API):
record['annotations.selected'] = false;
```

Records now provide a JSON  export:
![Screenshot 2025-01-21 at 16 31 17](https://github.com/user-attachments/assets/839697c5-941f-4ef5-9307-85d9c98cb6c8)

To see the editing inside an example app:
https://neomjs.com/examples/table/nestedRecordFields/index.html
