mirror of
https://github.com/demostf/demo.js
synced 2026-06-04 00:54:14 +02:00
improve packet parsing performance
Signed-off-by: Robin Appelman <robin@icewind.nl>
This commit is contained in:
parent
f92070d7ca
commit
c8e32078a4
1 changed files with 4 additions and 4 deletions
|
|
@ -45,9 +45,8 @@ function readEnterPVS(stream: BitStream, entityId: EntityId, state: ParserState,
|
||||||
const entity = new PacketEntity(serverClass, entityId, PVS.ENTER);
|
const entity = new PacketEntity(serverClass, entityId, PVS.ENTER);
|
||||||
entity.serialNumber = serial;
|
entity.serialNumber = serial;
|
||||||
if (instanceBaseline) {
|
if (instanceBaseline) {
|
||||||
const result = entity.clone();
|
entity.props = instanceBaseline.map((prop) => prop.clone());
|
||||||
result.applyPropUpdate(instanceBaseline);
|
return entity;
|
||||||
return result;
|
|
||||||
} else {
|
} else {
|
||||||
const staticBaseLine = state.staticBaseLines.get(serverClass.id);
|
const staticBaseLine = state.staticBaseLines.get(serverClass.id);
|
||||||
if (staticBaseLine) {
|
if (staticBaseLine) {
|
||||||
|
|
@ -57,7 +56,8 @@ function readEnterPVS(stream: BitStream, entityId: EntityId, state: ParserState,
|
||||||
parsedBaseLine = getEntityUpdate(sendTable, staticBaseLine);
|
parsedBaseLine = getEntityUpdate(sendTable, staticBaseLine);
|
||||||
state.staticBaselineCache.set(serverClass.id, parsedBaseLine);
|
state.staticBaselineCache.set(serverClass.id, parsedBaseLine);
|
||||||
}
|
}
|
||||||
entity.applyPropUpdate(parsedBaseLine);
|
entity.props = parsedBaseLine.map((prop) => prop.clone());
|
||||||
|
// entity.applyPropUpdate(parsedBaseLine);
|
||||||
// if (staticBaseLine.bitsLeft > 7) {
|
// if (staticBaseLine.bitsLeft > 7) {
|
||||||
// console.log(staticBaseLine.length, staticBaseLine.index);
|
// console.log(staticBaseLine.length, staticBaseLine.index);
|
||||||
// throw new Error('Unexpected data left at the end of staticBaseline, ' + staticBaseLine.bitsLeft + ' bits left');
|
// throw new Error('Unexpected data left at the end of staticBaseline, ' + staticBaseLine.bitsLeft + ' bits left');
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue