Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generating new game takes a long time #37

Open
verhoevenv opened this issue Jan 15, 2015 · 3 comments
Open

Generating new game takes a long time #37

verhoevenv opened this issue Jan 15, 2015 · 3 comments
Milestone

Comments

@verhoevenv
Copy link
Owner

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.

@verhoevenv verhoevenv added this to the v1.0 milestone Jan 15, 2015
@verhoevenv
Copy link
Owner Author

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.

@Enet4
Copy link
Contributor

Enet4 commented Jan 20, 2015

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.

@Enet4
Copy link
Contributor

Enet4 commented Mar 7, 2015

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++.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants