Skip to content

Improve calc performance - #10228

Open
vaisest wants to merge 3 commits into
PathOfBuildingCommunity:devfrom
vaisest:calc-perf
Open

Improve calc performance#10228
vaisest wants to merge 3 commits into
PathOfBuildingCommunity:devfrom
vaisest:calc-perf

Conversation

@vaisest

@vaisest vaisest commented Aug 15, 2026

Copy link
Copy Markdown
Contributor

Description of the problem being solved:

This improves raw calc performance (measured with a luajit script just running power report repeatedly) by around 20%. This is probably not going to result in the actual in-program report being 20% faster, but it's an improvement nonetheless

This is done by:

  • reusing existing metatables in new() instead of constantly allocating new ones
  • reducing node modlist scans by keeping track of what mods of interest are on the list, before checking them with :Flag()
  • not allocating a table for no reason in modDB calls

These were mostly done with LLM ideas and profiling, and a separate script running power reports on a spark build. I think there is certainly more room for improvement here, but it pretty quickly turns into adding more code, which isn't good for readability, and the gains aren't that amazing.

The class related code probably still sucks. There could be more room for improvement, and it might be noticeable, because the calc code creates a ton of mod lists using new()

Steps taken to verify a working solution:

  • Tests pass
  • Numbers are the same

Link to a build that showcases this PR:

Before screenshot:

After screenshot:

@vaisest
vaisest marked this pull request as ready for review August 15, 2026 15:34
@vaisest vaisest added technical Hidden from release notes pob2 Label for features that should be ported over to PoB-PoE2 labels Aug 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pob2 Label for features that should be ported over to PoB-PoE2 technical Hidden from release notes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant