Skip to content

Serialize font data into an ArrayBuffer#20197

Merged
calixteman merged 1 commit intomozilla:masterfrom
ryzokuken:sab-font-data
Sep 22, 2025
Merged

Serialize font data into an ArrayBuffer#20197
calixteman merged 1 commit intomozilla:masterfrom
ryzokuken:sab-font-data

Conversation

@ryzokuken
Copy link
Copy Markdown
Collaborator

This PR serializes font data into an ArrayBuffer
that is then transfered from the worker to the
main thread. It's more efficient than the current
solution which clones the "export data" object
which includes the font data as a Uint8Array.

It prepares us to switch to a SharedArrayBuffer
in the future, which would allow us to share
the font data with multiple agents, which would be
crucial for the upcoming "renderer" worker.

@ryzokuken ryzokuken requested a review from calixteman August 26, 2025 06:00
@ryzokuken ryzokuken self-assigned this Aug 26, 2025
Comment thread test/webserver.mjs Outdated
Comment thread src/shared/obj-bin-transform.js Outdated
Comment thread src/shared/obj-bin-transform.js
Comment thread src/shared/obj-bin-transform.js
@ryzokuken ryzokuken force-pushed the sab-font-data branch 2 times, most recently from b94a669 to f1c77a8 Compare August 26, 2025 07:51
Comment thread src/shared/obj-bin-transform.js Outdated
@calixteman
Copy link
Copy Markdown
Contributor

/botio test

@moz-tools-bot
Copy link
Copy Markdown
Collaborator

From: Bot.io (Windows)


Received

Command cmd_test from @calixteman received. Current queue size: 0

Live output at: http://54.193.163.58:8877/6e14aa6b1d242d0/output.txt

@moz-tools-bot
Copy link
Copy Markdown
Collaborator

From: Bot.io (Linux m4)


Received

Command cmd_test from @calixteman received. Current queue size: 0

Live output at: http://54.241.84.105:8877/674ef4520aa6062/output.txt

@moz-tools-bot
Copy link
Copy Markdown
Collaborator

From: Bot.io (Linux m4)


Failed

Full output at http://54.241.84.105:8877/674ef4520aa6062/output.txt

Total script time: 23.37 mins

  • Unit tests: Passed
  • Integration Tests: Passed
  • Regression tests: FAILED
  errors: 1109
  different ref/snapshot: 68

Image differences available at: http://54.241.84.105:8877/674ef4520aa6062/reftest-analyzer.html#web=eq.log

@moz-tools-bot
Copy link
Copy Markdown
Collaborator

From: Bot.io (Windows)


Failed

Full output at http://54.193.163.58:8877/6e14aa6b1d242d0/output.txt

Total script time: 49.14 mins

  • Unit tests: FAILED
  • Integration Tests: Passed
  • Regression tests: FAILED
  errors: 1109
  different ref/snapshot: 2

Image differences available at: http://54.193.163.58:8877/6e14aa6b1d242d0/reftest-analyzer.html#web=eq.log

@ryzokuken ryzokuken force-pushed the sab-font-data branch 2 times, most recently from a78f7e7 to 5f0e2fa Compare September 2, 2025 04:44
Comment thread src/shared/obj-bin-transform.js Fixed
@ryzokuken ryzokuken force-pushed the sab-font-data branch 2 times, most recently from eaeb707 to 1c2ea27 Compare September 2, 2025 17:31
@calixteman
Copy link
Copy Markdown
Contributor

/botio test

@moz-tools-bot
Copy link
Copy Markdown
Collaborator

From: Bot.io (Linux m4)


Received

Command cmd_test from @calixteman received. Current queue size: 0

Live output at: http://54.241.84.105:8877/3c3da7d0df464a2/output.txt

@moz-tools-bot
Copy link
Copy Markdown
Collaborator

From: Bot.io (Windows)


Received

Command cmd_test from @calixteman received. Current queue size: 0

Live output at: http://54.193.163.58:8877/216ff290b68a023/output.txt

@moz-tools-bot
Copy link
Copy Markdown
Collaborator

From: Bot.io (Linux m4)


Failed

Full output at http://54.241.84.105:8877/3c3da7d0df464a2/output.txt

Total script time: 23.52 mins

  • Unit tests: Passed
  • Integration Tests: Passed
  • Regression tests: FAILED
  errors: 1109

Image differences available at: http://54.241.84.105:8877/3c3da7d0df464a2/reftest-analyzer.html#web=eq.log

@moz-tools-bot
Copy link
Copy Markdown
Collaborator

From: Bot.io (Windows)


Failed

Full output at http://54.193.163.58:8877/216ff290b68a023/output.txt

Total script time: 49.25 mins

  • Unit tests: FAILED
  • Integration Tests: Passed
  • Regression tests: FAILED
  errors: 1109
  different ref/snapshot: 1

Image differences available at: http://54.193.163.58:8877/216ff290b68a023/reftest-analyzer.html#web=eq.log

@calixteman
Copy link
Copy Markdown
Contributor

/botio test

@moz-tools-bot
Copy link
Copy Markdown
Collaborator

From: Bot.io (Linux m4)


Received

Command cmd_test from @calixteman received. Current queue size: 0

Live output at: http://54.241.84.105:8877/210d3d3e388fdc2/output.txt

@moz-tools-bot
Copy link
Copy Markdown
Collaborator

From: Bot.io (Windows)


Received

Command cmd_test from @calixteman received. Current queue size: 0

Live output at: http://54.193.163.58:8877/a79b2a32552982d/output.txt

@moz-tools-bot
Copy link
Copy Markdown
Collaborator

From: Bot.io (Linux m4)


Failed

Full output at http://54.241.84.105:8877/210d3d3e388fdc2/output.txt

Total script time: 23.43 mins

  • Unit tests: Passed
  • Integration Tests: Passed
  • Regression tests: FAILED
  errors: 1109

Image differences available at: http://54.241.84.105:8877/210d3d3e388fdc2/reftest-analyzer.html#web=eq.log

@moz-tools-bot
Copy link
Copy Markdown
Collaborator

From: Bot.io (Windows)


Received

Command cmd_test from @nicolo-ribaudo received. Current queue size: 1

Live output at: http://54.193.163.58:8877/60e4fee3ecc3172/output.txt

@moz-tools-bot
Copy link
Copy Markdown
Collaborator

From: Bot.io (Linux m4)


Received

Command cmd_test from @nicolo-ribaudo received. Current queue size: 0

Live output at: http://54.241.84.105:8877/f12a598df83220a/output.txt

@moz-tools-bot
Copy link
Copy Markdown
Collaborator

From: Bot.io (Linux m4)


Success

Full output at http://54.241.84.105:8877/f12a598df83220a/output.txt

Total script time: 37.62 mins

  • Unit tests: Passed
  • Integration Tests: Passed
  • Regression tests: Passed

@moz-tools-bot
Copy link
Copy Markdown
Collaborator

From: Bot.io (Windows)


Failed

Full output at http://54.193.163.58:8877/60e4fee3ecc3172/output.txt

Total script time: 77.42 mins

  • Unit tests: FAILED
  • Integration Tests: Passed
  • Regression tests: Passed

Comment thread src/display/font_loader.js Outdated
Comment thread src/shared/obj-bin-transform.js
This PR serializes font data into an ArrayBuffer
that is then transfered from the worker to the
main thread. It's more efficient than the current
solution which clones the "export data" object
which includes the font data as a Uint8Array.

It prepares us to switch to a SharedArrayBuffer
in the future, which would allow us to share
the font data with multiple agents, which would be
crucial for the upcoming "renderer" worker.
@ryzokuken ryzokuken changed the title [WIP] Serialize font data into an ArrayBuffer Serialize font data into an ArrayBuffer Sep 19, 2025
@ryzokuken ryzokuken marked this pull request as ready for review September 19, 2025 06:36
@ryzokuken
Copy link
Copy Markdown
Collaborator Author

@calixteman thanks for the suggestions! Not just nitpicks, they helped clean up the code. Apologies for not having figured it out in the spur of the moment. I've also moved other (older) properties that were used by FontInfo into static properties of the class so everything is self contained as in the newer classes.

Marking this PR as ready for review.

@calixteman
Copy link
Copy Markdown
Contributor

/botio test

@moz-tools-bot
Copy link
Copy Markdown
Collaborator

From: Bot.io (Windows)


Received

Command cmd_test from @calixteman received. Current queue size: 0

Live output at: http://54.193.163.58:8877/33694271676e160/output.txt

@moz-tools-bot
Copy link
Copy Markdown
Collaborator

From: Bot.io (Linux m4)


Received

Command cmd_test from @calixteman received. Current queue size: 0

Live output at: http://54.241.84.105:8877/547627523594abd/output.txt

@moz-tools-bot
Copy link
Copy Markdown
Collaborator

From: Bot.io (Linux m4)


Success

Full output at http://54.241.84.105:8877/547627523594abd/output.txt

Total script time: 38.01 mins

  • Unit tests: Passed
  • Integration Tests: Passed
  • Regression tests: Passed

@moz-tools-bot
Copy link
Copy Markdown
Collaborator

From: Bot.io (Windows)


Failed

Full output at http://54.193.163.58:8877/33694271676e160/output.txt

Total script time: 77.88 mins

  • Unit tests: FAILED
  • Integration Tests: Passed
  • Regression tests: Passed

@calixteman calixteman merged commit 44affa7 into mozilla:master Sep 22, 2025
9 checks passed
Aditi-1400 added a commit to Aditi-1400/pdf.js that referenced this pull request Oct 6, 2025
Follow up on mozilla#20197,
This serializes pattern data into an ArrayBuffer which is
then transferred from the worker to the main thread.

It sets up the stage for us to eventually switch to a
SharedArrayBuffer in the future.
Aditi-1400 added a commit to Aditi-1400/pdf.js that referenced this pull request Oct 6, 2025
Follow up on mozilla#20197,
This serializes pattern data into an ArrayBuffer which is
then transferred from the worker to the main thread.

It sets up the stage for us to eventually switch to a
SharedArrayBuffer in the future.
Aditi-1400 added a commit to Aditi-1400/pdf.js that referenced this pull request Oct 7, 2025
Follow up on mozilla#20197,
This serializes pattern data into an ArrayBuffer which is
then transferred from the worker to the main thread.

It sets up the stage for us to eventually switch to a
SharedArrayBuffer in the future.
Aditi-1400 added a commit to Aditi-1400/pdf.js that referenced this pull request Oct 11, 2025
Follow up on mozilla#20197,
This serializes pattern data into an ArrayBuffer which is
then transferred from the worker to the main thread.

It sets up the stage for us to eventually switch to a
SharedArrayBuffer in the future.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants