Git Product home page Git Product logo

Comments (5)

Crafter-Y avatar Crafter-Y commented on June 18, 2024

The current implementation mapps a Brush Class like TreeSnipeBrush to multiple so-called handles. To my understanding, these act like aliases and produce the same result when used.

It currently uses the type Multimap<Class<? extends IBrush>, String>.
With that, it mapps e.g.:
TreeSnipeBrush.class => "t", "tree", "treesnipe"

It possibly can be changed to a Map<String, Class<? extends IBrush>>. I think this is what you meant with this issue.
Now the following mapping would take place:
"t" => TreeSnipeBrush.class
"tree" => TreeSnipeBrush.class
"treesnipe" => TreeSnipeBrush.class
therefore, there would be more data stored then needed.

from voxelsniper-reimagined.

KevinDaGame avatar KevinDaGame commented on June 18, 2024

That makes sense, The main reason we wanted a HashMap is because it's search performance is roughly O(1) while the search performance for a MultiMap at least how we currently do it is O(n) with n being the amount of entries

from voxelsniper-reimagined.

Lennart99 avatar Lennart99 commented on June 18, 2024

Maybe to add to @KevinDaGame's explanation:
The main point was that we had to check every entry of the multimap to find the required brush class, while we never really needed to get the names based on a class (except for unit tests, in which case performance is not as important). I think the amount of extra data stored is relatively small and worth the improvement in my opinion.

https://github.com/KevinDaGame/VoxelSniper-Reimagined/blob/master/VoxelSniperCore/src/main/java/com/github/kevindagame/VoxelBrushManager.java#L139-L143

from voxelsniper-reimagined.

Crafter-Y avatar Crafter-Y commented on June 18, 2024

than, this could be closed now.

from voxelsniper-reimagined.

Lennart99 avatar Lennart99 commented on June 18, 2024

not sure why it didn't close automatically, closed manually

from voxelsniper-reimagined.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.