it's because your code runs fully synchronous on the UI thread, so UI updates get queued but not rendered until it's done.