question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Issues with thousands of objects

See original GitHub issue

Issue Basics

  • ObjectBox version: 1.2.1
  • Reproducibility:
    • Issue 1: always
    • Issue 2 most times, it some persistence to reproduce

Reproducing the bug

Description

I have created a project to test ObjectBox’s performance with thousands of objects: https://github.com/jpmcosta/ObjectBoxTestProject/tree/ab97ac23ce6fa408f1313992fc72091fd52b3a9d

I have found 2 issues that I’m going to describe here as they seem to be related and I think it would be spammy to create multiple issues.

Code summary

The project has an App class that recreates data on each run. You can specify ITEM_COUNT and NOTE_COUNT_PER_ITEM to change the number of objects created.

A ProjectAdapter (ItemListAdapter) is used to display items of a project in a RecyclerView, using the following query:

fun BoxStore.getProjectItemsQuery(id: Long): Query<Item> =
        boxFor(Item::class.java).query()
                .equal(Item_.parentProjectId, id)
                .build()

When you click on an item in the list, Item.isActive is toggled.

Entities

@Entity
class Project {
    
    @Id
    var id: Long = NEW_ID

    @Backlink
    lateinit var items: ToMany<Item>
}
@Entity
class Item {

    @Id
    var id: Long = NEW_ID

    var isActive: Boolean = true

    @Backlink
    lateinit var notes: ToMany<Note>

    lateinit var parentProject: ToOne<Project>
}
@Entity
class Note {

    @Id
    var id: Long = NEW_ID

    var text: String? = null

    lateinit var parentItem: ToOne<Item>
}

Issue 1

If you set ITEM_COUNT to 20K and NOTE_COUNT_PER_ITEM to 4 (total: 80K objects), the objects are never created (I’ve waited a few minutes).

Issue 2

If you set ITEM_COUNT to 20K/80K and NOTE_COUNT_PER_ITEM to 0 (total: 20K/80K objects), the objects are created. However, there are 2 issues:

  • there’s lag when toggling Item.isActive (I guess that’s just a limitation)
  • if you click repeatedly on items in the list, eventually the DataObserver defined in ProjectAdapter will stop getting notified of changes. The toggle operation will still work (you can test that by scrolling the list to check if the item has changed).
    • to reproduce this issue it helps to spam click multiple items at the same time

Misc

I couldn’t reproduce those issues when I removed @Backlink annotation from Item.notes AND removed parentItem property from Note.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:13 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
greenrobotcommented, Feb 27, 2018

@rspl17 Support is done via stackoverflow.com @Yazon2006 We’re currently looking into the original issue. If you are getting an OOM, please open a new ticket with a stack trace and some more info - it’s not entirely clear to me what you are trying to do. Thanks!

1reaction
greenrobotcommented, Nov 28, 2017

I think you’re the first one using relations to do bulk-puts. Didn’t expect that use case. Will look in detail soon.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Performance issues when adding lots of objects to the scene ...
So I'm building something that currently looks a lot like minecraft - infinite voxel world, terrain generation, etc... Trouble is, when I add...
Read more >
Thousend Objects Performance Problems - Godot Engine - Q&A
Second, if you know your game has to check for tens of thousands of collisions between objects, you'll most likely arrange your data...
Read more >
Bad performance ungrouping thousands of objects (leading to ...
Summary: Inkscape freezes and eventually crashes when ungrouping an object. The file is only 6.4 MB so it is not a huge file....
Read more >
Problem with selecting thousands of objects in DRAW X5 W7-64
It runs the Suite great; starts up in under 2 seconds. However, when I attempt to select all objects in the file mentioned...
Read more >
Outlook performance issues in a Cached Exchange Mode .ost ...
Describes performance issues if there are lots of items or folders in a Cached Exchange Mode .ost or .pst file. Provides a resolution....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found