Another odd behaviour I found is that while the plugin is disabled, the SongHistory.txt continues to get updated. All the while MusicBee doesn't use any additional CPU, so no 8-12% CPU issue. Truly odd behaviour, but for me this is great, as it's the reason I've been using this plugin (I quickly stopped using those back/forward buttons, but it still would be nice to be able to use them).
I initially thought the issue would be due to my max lines being set to 10000000000 lines, but considering the text file continues to be appended to with no issue while the plugin's disabled while being on line 123252, that doesn't seem to be the case. Especially considering it still has the CPU issue when the text file only has 1 line.
I can't reproduce the SongHistory.txt (songhistory? it's supposed to be PlaylistHistory.History.txt) being updated while plugin is disabled. Do you have duplicate plugins installed? Maybe one in AppData and one in Program Files?
And with a simple modification, changing string concatenation to use StringBuilder instead, saving history for 140k files went from 15 minutes to 2 seconds.
Here's the link to the new version: Modified Playlist History Plugin
Thus far I had been using the plugin from the OP, not yours. I figured the only thing you changed was the working directories so hadn't tried yours yet. I'm giving this version a shot now, and it looks like it solves the CPU issue completely! Thank you very much for the fix.
However, I don't know if this is an issue with your plugin or the old one as I haven't used the back/forward feature in a while, but when I do so with your plugin, it goes to the FIRST instance of the last song I was on, vs. the actual position in the queue it was in (there are 3 instances of the song I tested).
I tried testing the original version of the plugin, but that kept erroring and clearing my queue (thank god I had made a backup before trying this). I had only put your version in a completely new copy of my portable MusicBee install so as to not mess with my original install, so that rules out your version conflicting with the original, at least.
So, I'm not sure if this is something you can fix with the specific queue position, but if so, it would be amazing! I think you could just have it remember the position in the queue, as I believe you're essentially restoring the entire queue when using this plugin, so it's bound to land on the correct track still.
Also, earlier I mentioned that SongHistory.txt was seemingly still functional with this plugin disabled. I had forgotten that that's a completely separate plugin that I simply set to save the txt file in the PlaylistHistory plugin's folder, which is why I thought it was part of this plugin when in reality it is not!