title: What is the most efficient way to store long list of Objects in Realm?
body: <p>I'm trying to compare <strong>Realm</strong> with <strong>Snappydb</strong> (<a href="https://github.com/Hesamedin/DatabaseTester" rel="nofollow noreferrer">This is my repo</a> for those who would like to have a look at benchmark). I guess my way is wrong, as store-to-db time takes super long time in Realm in compare with Sanppydb.</p>
  
  <p>Benchmark shows following result. As you can see in the image, Realm is around 100-200 times slower than Snappydb.
  <a href="https://i.stack.imgur.com/TVBBm.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/TVBBm.png" alt="enter image description here"></a></p>
  
  <p>What I'm doing is creating 10,000 objects first and then storing them into the db. So, in my code I store a Booking object in this way (there is a for loop that iterates 10,000 times):</p>
  
  <pre><code>public void storeBooking(final Booking booking) {
          mRealm.executeTransaction(new Realm.Transaction() {
              @Override
              public void execute(Realm realm) {
                  Booking realmBooking = realm.createObject(Booking.class);
                  realmBooking.setId(booking.getId());
                  realmBooking.setCode(booking.getCode());
                  realmBooking.setFareLowerBound(booking.getFareLowerBound());
                  realmBooking.setFareUpperBound(booking.getFareUpperBound());
                  realmBooking.setPhoneNumber(booking.getPhoneNumber());
                  realmBooking.setPickUpTime(booking.getPickUpTime());
                  realmBooking.setRequestedTaxiTypeName(booking.getRequestedTaxiTypeName());
                  realmBooking.setTaxiTypeId(booking.getTaxiTypeId());
              }
          });
      }
  </code></pre>
  
  <h2>Update</h2>
  
  <p>This is Snappydb method for storing Booking object.</p>
  
  <pre><code>public void storeBooking(final String key, final Booking booking) {
          try {
              mSnappyDb.put(key, booking);
          } catch (SnappydbException e) {
              e.printStackTrace();
          }
      }
  </code></pre>
  
  <h2>Update</h2>
  
  <p>New results using <code>insertOrUpdate()</code> method and one transaction</p>
  
  <p><a href="https://i.imgur.com/QgCFSbG.png" rel="nofollow noreferrer"><img src="https://i.imgur.com/QgCFSbG.png" alt="enter image description here"></a></p>