Hi
This is possibly something which can wait until after the C++ port but is something I have noticed when saving even smallish trees (~5 nodes or more): The UI freezes.
I think this is related to #777, which speeds up load times but not save times, as an example saving ~50 nodes (after importing) took almost 5 seconds in which cherrytree was completetly unresponsive
A possible quick workaround for this I think would be to just do the saving on a separate thread, there would have to be locking for XML files and something to prevent cherrytree closing while it was saving but it should not be too difficult (actually I am quite surprised that the saving _is_ on the UI thread right now)
I cannot reproduce it, 100 nodes (though it's mostly a text) saves/resaves without any issue. I used virt. machine with 2 core and not much memory. Everyone would be notice such issue with 5 nodes.
Mine is just text too... that is strange. Currently ive only tested it with nodes that have been imported (overwise I have to edit all the nodes) - It does not have any issue saving nodes if they have not been edited ofc it only does that if I have multiple unsaved nodes
Edit
The UI freeze for me is short but noticable with 5 nodes, its only once things start getting bigger that it becomes a big annoyance but it is possibly something up with my setup if you cannot reproduce it
I'm noticing a UI lag not while saving, but prior to quitting. i.e. if Auto-Save is off & I quit, the UI locks up for 5+ seconds before it prompts me for whether or not I want to save. Not sure if it's the same issue, but seems like it might be related? On Windows.
@ForeverRainbow, if the issue is still presented, you can try one of the following things:
Update on this, just tested it again with ~15 unsaved nodes (5 tables, no text), it is only an issue when using SQLite, XML saving happens almost instantly - the SQLite save took 2-3 seconds.
To reproduce the issue, at least on my machine:
@txe Is there any reason why the saving _can't_ be made multi-threaded? Cause I could give a crack at it if there is nothing major
Nothing prevents using multi-threads, I just want to know what the root of the issue is before using the hammer.
Ok, I'm having the same problem, also with the SQLite backend. I am seeing the UI freeze for 20 seconds, and the time is growing as my note size grows. I posted this issue in #854
@ForeverRainbow, I tested
Turns out, taking buffer from image (pixbuffer) to save it in db is quite slow. So far I see two solutions:
Any other ideas?
@ForeverRainbow, I'm still confused by your words
Import a bunch of nodes, at least about 10 or so (with or without widgets)
That it can be slow without widgets, I couldn't reproduce it, are sure?
Well, you said xml saving is fast and sqlite is slow, thus taking buffer from image is not your issue.
@giuspen , when you have time, can you repeat this:
Open a new instance
Save it in SQLite format
Import a bunch of nodes, at least about 10 or so (with or without widgets)
Hit save and count
@txe I was trying on msys2 today for the spell check languages and even without importing nodes the UI felt slower than the Pygtk2 version, lagging too much. I will help looking into this later when have more time but I would not give top priority to this, I'm sure we'll sort it out!
Well with msys2 it's not surprising, even compilation is 3 or 4 times slower there than on linux.
I hope you don't have these lags on linux otherwise it's just crazy.
No my report was msys2 only, haven't seen lag issue on Ubuntu 20.04
@giuspen - as mentioned in the issue I posted above (#854), I'm on Ubuntu 16.04 and the freezes are bad enough on big notes that it becomes hard to use.
@DiagonalArg , it was about another issue, I'm working on your issue, don't worry.
@txe This _may_ be related to #861, although I am not sure, if it is caused by the pointer arithmetic then before it would just be filling it with junk or crashing or god knows what anyway. I have just been testing it with a clean config and I am getting less than a second save times even with 50+ nodes. So it is possibly the config, something weird on my end which fixed itself, or something else but this issue seems to have fixed itself for now.
@txe I think the second option (caching the images during saving) is probably better, 2x the size can be big for a node full of images. Also the con of only being faster by number of threads is true but once its off the UI thread then save time is not such a massive priority, even if its save on close cherrytree can ghost until its done saving
Closing this issue which was caused by config.cfg file. It was fixed by checking some conditions during reading the configure file.
About concurrent saving images, I added PR #928