Skip to content

Conversation

@Leridon
Copy link
Contributor

@Leridon Leridon commented Feb 1, 2026

Had a look into the library to improve performance of data transfer for puzzle and chatbox readers in Clue Trainer, and came across this section, which has some potential in my opinion.

  • Transfers are batched horizontally to make combining them faster by copying entire sections instead of individual bytes.
  • Use faster library for base64 decoding (byte-base64)
    • I know dependencies suck, but this might be worth it. The Buffer.from(str, "base64") alternative is slowe by a huge factor.
  • Simplify conversion from bgra to rgba

Profiling on my device results in speedups of around 30%, both for smaller areas (slider puzzles) and full screen captures.

This only covers the path via ImgRefBind.read. I haven't touched other usages of decodeImageString yet, but they are probably worth looking at as well.

There's also the question of maxtransfer. Why is the value in wrapper.ts (40000) different from the one that is provided at runtime at alt1.maxtransfer (100000)? Which one is right? Could performance be improved by using the larger one?

- Transfers are batched horizontally to make combining them faster.
- Use fast library for base64 decoding
- Simplify conversion from bgra to rgba
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.

1 participant