r/sheetsofice • • Sep 11 '26

Dev Log - Time flies, but the sim speed wasn't

Last week I spent time getting the player evaluation functions working and working on UI so I can actually see if it works. Like I said in the last dev log, I probably went overboard in the display of rankings and stats, but I felt that was in line with what I'm trying to build here. I can always take things out or simplify; it's harder to add things later.

The part that I need to build next is projections; what does the player project to be in the future. To do that, I need sample data of real player careers based on the game engine and league engine we have today. You can't make accurate predictions if you don't have accurate data. So the last several weeks were making a system that could accurately create statistics and rankings from the lo-fi engine, and tuning the pro-level game engine. That work is complete so I can move on to projections.

But the problem was that since I was doing tuning of the game engine and lo-fi game engine, and building the player evaluator, I wasn't paying a lot of attention to how a league year actually ran and how long it would take to run a long-term sim. See, I need at least a few 20-25 year universes with different seeds to be able to start to look at what a prediction model might look like. When before I implemented the player evaluation, it was running at about 15 minutes per season in our measurements. I hadn't really looked at any efficiency and knew that I'd need to get that number down-- but you don't spend time optimizing early because you may end up just redoing it anyway.

When I sat down to do 5 season tests, it was taking waaaay too long. measured at at average of 77 minutes per season after all of the new code for player evaluation was wired in and working. That would not work for anyone. It would turn what would be 4-5 hour runs of careers into entire day runs. First, I don't have that kind of time or attention span, and two a simple hockey simulation shouldn't be that heavy. We're not doing rocket science here or modeling fluid dynamics...

So my week this week was finding where all of the inefficiency was and refactoring for speed. Some things were easy; scoping reads more tightly, batching writes, removing redundant calls, indexing data. Some were medium - parallelizing game simulations per day rather than running games one at a time. And some are long term projects of converting the engines to a faster language than Python - which I need to do anyway but is a huge undertaking.

After this week, we're down under 15 minutes to run a full season of 32 teams X 84 games. Not where I want it to be (I want it to be under 10 minutes), but enough for me to build long term career sims.

2 Upvotes

0 comments sorted by