tee-ar-ex / tee-ar-ex/trx-javascript

Performance and TypeScript

Open
#5 2 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
1
Forks
4
Avg merge
47m
Merged PRs (30d)
2

Description

Inspired by @nx10 NIfTI acceleration, we can improve performance and reduce dependencies by replacing fflate with the new compression streams API. By moving to TypeScript, we can maintain compatibility with NiiVue while still compiling to pure JavaScript. At the moment, the new code is on a separate fork, but it can be merged soon.

Since TRX is based on the Zip format (not just deflate or gzip), I adapted @ndesmic's zip class using compression streams. I extended that minimal example adding support for zip64 formats as well as zip files that use data descriptors rather than explicitly reporting compressed size (I think this was mainly for tape drives, where random access was problematic).

I also optimized the TRX code, so even the uncompressed TRX files are accelerated.

Using compression streams is somewhat faster on node (as shown below). However, it appears to be dramatically faster on the Google chrome browser (x2).

Old node performance:

IFOF_L.tt.gz	Size	17564621	Time	7214
IFOF_L32z.trx	Size	68392480	Time	7346
IFOF_L16z.trx	Size	56518628	Time	7302
IFOF_L.tt	Size	34713543	Time	4701
IFOF_L.vtk	Size	263300470	Time	1733
IFOF_L.trk	Size	137369684	Time	1420
IFOF_L.tck	Size	137615752	Time	973
IFOF_L16.trx	Size	68746591	Time	718
IFOF_L32.trx	Size	137369221	Time	472

New node performance:

IFOF_L.tt.gz	Size	16547280	Time	5793
IFOF_L32z.trx	Size	68392480	Time	4552
IFOF_L16z.trx	Size	56518628	Time	3175
IFOF_L.tt	Size	34713543	Time	5005
IFOF_L.vtk	Size	263300470	Time	1408
IFOF_L.trk	Size	137369684	Time	1288
IFOF_L.tck	Size	137615752	Time	843
IFOF_L16.trx	Size	68746591	Time	670
IFOF_L32.trx	Size	137369221	Time	317

Image

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by comparing the current repository with the separate trx-javascript fork linked in the issue, focusing on the existing fflate-based implementation and its ZIP handling. Verify support for ZIP64 files and data descriptors, then rerun the Node and Chrome performance comparisons shown in the issue; done means the TypeScript implementation preserves TRX compatibility while reducing dependencies and improving performance.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, typescript
Domain
performance
Issue type
Refactor
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.