Skip to content

PCDLoader: parse header without TextDecoder#31069

Merged
Mugen87 merged 2 commits intomrdoob:devfrom
stardustai:feat/fast-header-parse
May 9, 2025
Merged

PCDLoader: parse header without TextDecoder#31069
Mugen87 merged 2 commits intomrdoob:devfrom
stardustai:feat/fast-header-parse

Conversation

@F-loat
Copy link
Contributor

@F-loat F-loat commented May 9, 2025

Related issue: -

Description

More efficient parsing of header information.

image

@Mugen87
Copy link
Collaborator

Mugen87 commented May 9, 2025

How does these numbers compare to the previous version of PCDLoader?

@F-loat
Copy link
Contributor Author

F-loat commented May 9, 2025

@Mugen87 The ascii in the above figure represents the time taken by the previous version, and the binary represents the time taken by new version.

The parsing time of the old version will increase significantly as the pcd file becomes larger, while the new version keeps a relatively low parsing time.

@Mugen87
Copy link
Collaborator

Mugen87 commented May 9, 2025

Is the performance different that large because TextDecoder essentially parses the entire data and not just the header?

AFAIK, PCD headers do not have a fixed size so it is not possible to detect the header portion of the binary data. TextDecoder must decode everything which is of course slow, right?

In this case, the proposed change looks good

@Mugen87 Mugen87 added this to the r177 milestone May 9, 2025
@F-loat
Copy link
Contributor Author

F-loat commented May 9, 2025

Yes, for the reason you said TextDecoder can only parse the entire file, which is wasteful.

@Mugen87 Mugen87 merged commit 1815e4f into mrdoob:dev May 9, 2025
11 checks passed
@F-loat F-loat deleted the feat/fast-header-parse branch May 9, 2025 09:27
RuthySheffi pushed a commit to RuthySheffi/three.js that referenced this pull request Jun 5, 2025
* feat: parse binary pcd header  directly

* chore: unify variable naming
RuthySheffi pushed a commit to RuthySheffi/three.js that referenced this pull request Jun 5, 2025
* feat: parse binary pcd header  directly

* chore: unify variable naming
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants