stefanceriu / SCXcodeMiniMap

Sublime Text like Minimap for Xcode
GNU General Public License v3.0
1.03k stars 87 forks source link

1500 lines of C++ code #29

Closed Mazyod closed 9 years ago

Mazyod commented 10 years ago

Hey,

Thanks for the great plugin. I love it, however, it renders Xcode unusable when I am working on a C++ project, and especially with a huge file (1500+ lines of code).

I haven't looked at the implementation, but I would guess the only cause is that the minimap updates are too often. I mean, they don't have to be real time, right? The point of minimaps (IMHO) is to get a glance of how long the file is, and get an idea of where certain code might be.

Thanks,

Gui13 commented 9 years ago

+1! It is really slow on some files..

stefanceriu commented 9 years ago

Hey guys,

The problem isn't caused by the number of updates but by the syntax highlighting. Because the MiniMap shows much more text than the actual editor Xcode needs to go and fetch that information, which turns out to be a very slow process.

I managed to hook into the DVTTextStorage and make incremental updates to the MiniMap's text view but the syntax highlighting still slows it down allot.

I'll let you know if I figure anything out and in the meantime any suggestions are welcome.

Cheers, Stefan

Mazyod commented 9 years ago

Thanks for the reply.

Maybe something in the lines of doing some off-screen rending of an image on a worker thread or something. The worker might render once every X amount of time, or simply cancels the current work if new work comes in.

This will eliminate all the real time features, such as when the user types away or resizes the window, but in terms of priority, slowing the editor is breaking the whole experience, whilst losing the real time rendering might not even be noticeable by many users, while others will find it as a mere annoyance.

Now, if fetching the syntax highlight info is not thread safe, and has to be done in the main thread, then god bless. Your incremental updates approach is the best way in that case, probably. Giving the task a limited time on the main thread, then calling [[NSRunLoop mainRunLoop] runUntilDate:...]; to avoid hogging the main thread.

stefanceriu commented 9 years ago

So I just pushed v2.0, performance shouldn't be a problem anymore :)

Mazyod commented 9 years ago

Sick, been waiting for this one! Productivity++ Thanks!

stefanceriu commented 9 years ago

I certainly hope you won't have any problems with it and go productivity-- :)) Either way, please let me know how it goes.

Gui13 commented 9 years ago

Sadly for me: #39 :( Although the Zip install works.