Im optimizing for IDE speed. What is better? All c...
# compose
a
Im optimizing for IDE speed. What is better? All composables in one screen or split into multiple files? Does it matter at all or is it just modules that matter?
s
The only way it’s getting any optimization help is apparently with Ryzen 9 9950 or Apple M4 Max and 64GB of RAM 😅
😁 1
t
For me it usually matter, no directly to IDE speed but for mine speed to work with. Android Studio can't lock preview, so preview is always switched to the opened file. So I usually rather put some related parts to one file to see the preview all the time when I'm working on it. They are usually part of one screen anyway.
s
@Alex Styl define "IDE speed". Are you talking previews rendering/refresh? Editor performance (e.g. highlighting)? Build speed?
a
@seb editor performance, mostly refactoring code ie extract to function with CMD + M. Im to the point it takes ~1 second to create a new fun like this
s
Lord how much stuff do you have in the file?
😁 1
🫶 1
If it's editor perf I'd suggest splitting the file up
The larger a file, the larger its in-memory representation is (and the longer it takes to parse, highlight, etc)
(massive oversimplification but should be ~correct)
a
i do have some 1-3k LOC files, but i see the same in a 300 LOC too
s
Modern software 🥲
s
That's not very large, it shouldn't cause issues tbh
It might be you're not allocating enough RAM to the IDE, or something else is going wrong (e.g., you are on Windows and you haven't excluded your source code from antivirus realtime scanning)
a
@seb you mean 'maximum heap size' right? It's at
24096
MB rn. at least via the option of the ide.
👀 1
im on a M3 Max with 48GB for the record
s
That might even be too much, allocating too much heap memory could hurt performance as well.
s
24gb should be plenty
Do you have any 3p plugins enabled in the IDE?
Fwiw 16 GB is more than enough for me to keep both Studio and IJ projects open at the same time, with room to spare for extra smaller projects, and I have no such slowdown issue (M1 Max, 64 GB)
a
what is 3p?
3rd pary. let me check
s
Third party. That is, did you install any plugin from the marketplace? Including themes
Some 3p themes do weird shit, so that may also be a problem
s
Check if you’re using a plugin that colors curly braces differently. It’s quite heavy in my experience.
u
When optimizing for IDE performance, especially in large Android projects, splitting composables into multiple files is generally better. It improves readability, speeds up indexing, and reduces lag during edits. While modularization has a much greater impact overall, organizing composables into smaller, focused files still helps maintain IDE responsiveness—especially as the project scales.
a
@seb disabled everything. perf didnt really change. (had 1 or 2 third party) any idea if public fields affect the ide perf? I might have tons of consts for example. does the auto complete happen in advance?
s
It was worth a try 😞
👍 1
any idea if public fields affect the ide perf? I might have tons of consts for example.
I don't think it's any different from any other symbols
does the auto complete happen in advance?
Not sure what you mean, but completion is based on the index, which is computed in advance. The actual completion is done in real time.
t
I have 8192MB heap for AS. I have currently opened 5 projects, biggest one has 38k LOC. And no problem with IDE speed. Yes refactoring took few seconds. Biggest problem is definitely build time 😉
a
a few seconds to refactor code is a big issue for me. defeats the purpose of using an ide as i use shortcuts all the time
s
depends what you're refactoring. if the slow part is the "fixing imports across the project" then that's somewhat understandable. if it's slow even at renaming a local variable then there are issues
t
yes, extracting code to the new method is definitely less than 1s
s
I guess the other relevant question is: is this a new perf degradation, or is this in line with how it's always been? If it's the latter, I don't know what the margin for improvement realistically is
t
But renaming base class for all ours activities takes 10s
s
Yeah that makes sense if it has to traverse the index for the entire project
👍 1
c
I've had 2k-3k files that just slow to a crawl for highlighting etc. as small files as possible is 100% better for IDE perf. I'm hoping k2 solves this though. its so bad with k1 and large ish files
s
It should. It's the default in 25.1 tho iirc so if you're already on 25.1, make sure it's enabled
c
last i heard from tor the latest canaries for AS still don't fully support k2
s
Huh, ok. That's odd. I thought we did all the k2 work last year. Must be some lingering issue if that's still the case
a
Regarding the Compose previews, I found Android Studiko to be much more usable if you set the "Quality setting" for the Layout Editor to "Fastest" in the Android Studio settings (section Experimental). After that, Android Studio didn't lock up anymore for me.
c
Tor just responded to me about k2. looks like theres still work to be done, but its a good time to enable it and report bugs. https://bsky.app/profile/tornorbye.bsky.social/post/3loe5i7o3bs2j
🙏 1
c
video from today... 👀
s
well feature complete doesn't mean 100% bug free
Lol
😅 1