Skip to content

Optimize name-id-lookup for mapblock serialization - #16000

Merged
sfan5 merged 6 commits into
luanti-org:masterfrom
Desour:performance_mapblock_serialize_optimize_nameidlookup
Apr 14, 2025
Merged

Optimize name-id-lookup for mapblock serialization#16000
sfan5 merged 6 commits into
luanti-org:masterfrom
Desour:performance_mapblock_serialize_optimize_nameidlookup

Conversation

@Desour

@Desour Desour commented Apr 10, 2025

Copy link
Copy Markdown
Member
  • Goal: Improve performance of mapblock de-/serialization.
  • Commits should be self-explanatory.
  • Interesting side-node: It looks to me like loops over all nodes in a mapblock are completely rolled out. Idk if this is fine or not. Edit: Oops, found the jmp now.

To do

This PR is a Ready for Review.

How to test

  • time luanti --server --recompress --worldname name_of_your_world
  • (For reproducibility, first do it once to make sure the blocks are all in newest format, and avoid differences due to caching of the db file.)
  • Tested with a ca. 100MB block data db:
    • master:
      • real 0m52,698s
        user 0m43,924s
        sys 0m2,004s
      • real 0m50,189s
        user 0m44,164s
        sys 0m1,665s
      • real 0m57,698s
        user 0m50,291s
        sys 0m1,936s
    • PR:
      • real 0m44,240s
        user 0m35,712s
        sys 0m1,894s
      • real 0m42,180s
        user 0m36,517s
        sys 0m1,686s
      • real 0m42,680s
        user 0m37,303s
        sys 0m1,793s

Comment thread src/mapblock.cpp
Comment thread src/mapblock.cpp Outdated
Comment thread src/mapblock.cpp Outdated
@sfan5
sfan5 self-requested a review April 12, 2025 08:41
Comment thread src/mapblock.cpp Outdated
@Desour Desour changed the title [NoSq] Optimize name-id-lookup for mapblock serialization Optimize name-id-lookup for mapblock serialization Apr 12, 2025
@Desour
Desour requested a review from sfan5 April 12, 2025 15:55

@sfan5 sfan5 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@sfan5
sfan5 merged commit 60c47c5 into luanti-org:master Apr 14, 2025
@Desour
Desour deleted the performance_mapblock_serialize_optimize_nameidlookup branch April 14, 2025 19:45
mjz19910 pushed a commit to mjz19910/luanti that referenced this pull request Apr 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants