Closed vHanda closed 3 years ago
We'll try to reproduce using your repo. I didn't see any stories in your repo. Would you mind sharing the code for the stories you are using?
I'm not able to reproduce the latency you experience. However, we are interested in getting you set up well with Monarch. GitJournal is a great project to showcase Monarch. We could write an initial set of stories to make sure things are working well.
I played with changes to purchase_thankyou_screen.dart and screens_stories.dart. After the first warm-up runs, my reload times are always less than 12 seconds or 3 seconds, depending on the type of change. Here's my log:
Starting Monarch ... Preparing stories completed, took 59.5sec ... Launching Monarch app completed, took 4.3sec ... Monarch is ready to use ... Setting up stories watch completed, took 39.8sec
(First change to purchase_thankyou_screen.dart) Reloading stories completed, took 32.8sec
(Second change to purchase_thankyou_screen.dart) Reloading stories completed, took 11.8sec
(Third change to purchase_thankyou_screen.dart) Reloading stories completed, took 11.5sec
(Adding a new story to screens_stories.dart) Reloading stories completed, took 2.5sec
(Making a change in screens_stories.dart) Reloading stories completed, took 2.1sec
(Fourth change to purchase_thankyou_screen.dart) Reloading stories completed, took 11.4sec
I run the test above in a MacBook Pro, year 2017, 2.5 GHz Dual-Core Intel Core i7, 16 GB memory, running Big Sur.
I had some syntax errors when I first run the GitJournal code, so I changed a couple of things:
I don't think any of those changes would have affected the performance though.
Let us know if you have more details we could use to reproduce the performance issues. You could also send me (ftrigoso@dropsource.com) the log you get when you run monarch run -v
.
Hello. I'm sorry for the delay. I thought I'll try to diagnose this a bit more, but I haven't had the time. I'm attaching monarch -v
. My laptop is quite old MacOS 2013 - 2.6 GHz Dual-Core Intel Core i5.
My main issue is how long it takes to reload the stories once a file has changed. The initial job to watch all the stories took 2min, and a simple reload of one file took 1.7 minutes. This negates the benefit of hot reload.
I'll try to debug this a bit more on my own. Could you please point me towards the reloading stories code? I can't seem to find it.
Regarding -
GitJournal is a great project to showcase Monarch
I would love that. I've added a few more stories. I'm slowly adding stories for every screen, however the big reload times keep me from using it properly. I usually just launch the desktop app.
I got a fix for you. Create a file build.yaml
at the root of your project directory with these contents:
targets:
$default:
sources:
- $package$
- lib/iap/**
- lib/setup/**
- lib/screens/**
- lib/monarch.dart
- lib/$lib$
Then do:
flutter clean
flutter pub get
monarch run
Your reload times should decrease drastically. Keep in mind that as you add more stories to other directories you will have to add them to the build.yaml so that they are part of the code generation and file watch.
Please let me know your new reload times. More details below.
I ran GitJournal in an older mac mini from 2014, which has the same processor specs as your laptop (2.6 GHz Dual-Core Intel Core i5). After warmup, reloading stories took around 18 seconds, which is faster than what you are getting, but still too slow for a reload. Then, I realized the code didn't have a build.yaml.
After creating the build.yaml and editing it to include only the directories that contain stories and monarch annotations, the reload times went down to 2 seconds!
The command monarch init
creates an initial build.yaml. However, that initial build.yaml includes the entire lib directory and it wasn't going to help you much. GitJournal is not a small project, it has lots of files and you are probably running on a SATA disk. I think the latency you are experiencing is mostly file I/O.
By the way, I like how you created a monarch.dart file which contains all the localization and theme declarations monarch needs.
If this fixes the high reload times, then let's discuss how we can help you with your stories.
Hi. Lots of tests later, it turned out that my macbook is overheating and was often being throttled down to 25%, this is why Monarch takes so long. When developing with flutter, I used to press 'r' manually to reload / make vscode send the signal, so the file watching wasn't necessary.
Adding the build.yaml
file didn't really help.
Since then I've moved to my linux desktop, as my laptop is just too slow. I haven't been using monarch as I'm waiting for the web and/or linux support. I'm going to close this bug. Thanks for the help.
Hi. In my project, using
monarch run
on my macos often takes a long time to start. Whereas run the macos version of the app via "flutter run', takes only about 1-2 minutes.I only have 8 widgets exposed. The way I see it, this runs in 2 phases -
Preparing Stories
First Run: 3.3m Second Run (no files modified): 12.3s Second Run (one story file touched): 1.7m
Setting up stories watch..
This routinely took between 40-60 seconds, irrespective if the files were touched.
Is there something I can do to speed it up?