title: Can I shorten the room insertion time using RxJava?
body: <p>I am developing an android app. I'm having a hard time writing code that adds a to-do list to a calendar. Let me show you the code first.</p>
  <pre><code>private fun addTodoList(entity: MyTodo) {
      val start = Calendar.getInstance()
      val end = start.clone() as Calendar
      end.time = SimpleDateFormat(&quot;MM dd, yyyy&quot;, Locale.getDefault()).parse(Date.END_OF_DAY)!!
  
      CoroutineScope(Dispatchers.Default).launch {
          val id = MyDatabase.getInstance(mContext).getTodoDao().insert(entity)
          val dao = MyDatabase.getInstance(mContext).getCalendarDao()
  
          do {
              val date = ymd.format(start.timeInMillis)
              val item = CalendarEntity(date, id.toInt())
              dao.insert(item)
              start.add(Calendar.DAY_OF_MONTH, 1)
          } while (start.timeInMillis &lt;= end.timeInMillis)
      }
  }
  </code></pre>
  <p>This is the code that inserts the <code>Todo</code> created by the user through <code>TodoDao</code>, and inserts the value into <code>CalendarDao</code> from today to <code>Date.END_OF_DAY</code> (I randomly designated this value as &quot;December 31, 2025&quot;). But the insertion speed through <code>CalendarDao</code> was quite slow. There is no inconvenience in the UI, but if the user completely terminates the app from the task during insertion, it will be terminated without inserting data until the end. It has been said that using <code>RxJava</code> can solve this problem, how can you solve it? Even if it's not <code>RxJava</code>, if there is a way to solve this problem, please let me know.</p>