Comments (5)
Hm, that would mean that you should have observed slower load times everywhere, especially when loading the VOb tree. There might be optimisations that can be done in messages
though.
from zenkit.
I've made a few experiment locally:
-
removing
std::stringstream
- generally nice, but not critical improvement. -
replacing
messages::_m_blocks_by_name
to sort + binary search - work quite well
// messages messages::parse(buffer& buf)
...
std::sort(msgs.blocks.begin(), msgs.blocks.end(), [](const message_block& l, const message_block& r){
return l.name<r.name;
});
return msgs;
}
const message_block* messages::block_by_name(std::string_view name) const {
auto it = std::lower_bound(blocks.begin(), blocks.end(), name, [](const message_block& l, std::string_view name) {
return l.name < name;
});
if (it!=blocks.end())
return &*it;
return nullptr;
}
from zenkit.
It certainly makes sense that not allocating potentially thousands of small std::string
s would make loading faster. Are you sure that in-game performance is actually acceptable using binary search instead of std::unordered_map
's O(1) access times?
from zenkit.
Yes, I've tested this solution locally.
Also fetching block_by_name
relatively rare case (roughly a 1 call per 3 seconds). Worst what can happen is spike at search call.
from zenkit.
Implemented :)
from zenkit.
Related Issues (20)
- Issues with TheChroniclesOfMyrtana mod HOT 23
- Procedure entry point failure at runtime when linking phoenix HOT 6
- Out of memory crash while parsing `ORCGRAVEYARD.ZEN` HOT 3
- [v1.1.1] Missing catch/re-throw on `sto_` calls
- DaedalusVM - external_function call - shared_ptr seems to point to nowhere any longer HOT 2
- `npc_type` mismatch between G1 and G2 HOT 5
- Syntax error while pasrsing `orctempel.zen` HOT 2
- Parse of "JustWhite" lighting preset resulting in wrong color HOT 3
- Parse of empty model-source HOT 7
- Reconsider usage of `unordered_set/map` HOT 4
- Incorrect parsing of `mds::event_tag`
- `Vfs::child` : Name comparison fails due to extra whitespace HOT 6
- Vfs: Node names may be cut off if the contain spaces HOT 2
- CI tests fail after 9e8458ed
- High order functions HOT 5
- Improvals to function calls HOT 4
- Support `-flto` HOT 2
- Performance consern regardless `zenkit::Polygon` HOT 6
- ZenKit migration issues HOT 11
- Potential Bug: Stack is cleared after Daedalus function call HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from zenkit.