Open verhoevenv opened 9 years ago
So OpenNotrium is a lot slower, and it's not compile speed or anything. It's because basic Notrium is a bit broken.
The main slowdown comes from logging, and that's mainly because each line logged opens a file, writes the line, then closes it again, forcing a flush. That's a lot of disk IO.
But if you install Notrium in Program Files, it doesn't have permission to write log files in that directory. So it doesn't log, and everything goes a lot faster. If you take it to a directory where it does have write permissions, it'll take as long as OpenNotrium.
Anyway. Logging shouldn't slow down game loading from 2 seconds to 12. I guess we should log a whole lot less by default, but provide the option to mod writers. Another option is to buffer the log, and not flush everything immediately, but that seems a bit against the point of logging... Maybe we need different classes of service, like flush when we get errors but buffer for a while for simple info messages.
I would first suggest not flushing when we know there are more log entries to come, such as when generating a new game. It would only lose some of the log in case of a severe crash, and such cases would have to be analysed with a debugger anyway.
On the other hand, how about we integrate an existing logging library for C++? Not only the library would know how to handle file I/O when logging, but would also give us many levels of freedom on what to log and what to print to the console, usually without introducing overheads. Easylogging++ looks pretty amazing and suitable for OpenNotrium. How about we attempt to integrate it (or some other tool, there are plenty out there)?
Edit: just keeping record of a branch in which I started replacing logging with Easylogging++.
On my PC, starting a new game in a release build of OpenNotrium takes about 12 seconds. Contrast with Ville's Notrium 1.345 which takes about 2 seconds to create a new game.
It might be compiler settings but that is a huuuuge difference.