New changes for File APIs in the Firefox Front-end

61 views
Skip to first unread message

Keefer Rourke

unread,
Aug 28, 2020, 10:10:14 AM8/28/20
to firef...@mozilla.org
Hi folks,

I'm Keefer — this summer I had the amazing opportunity to intern with the Firefox Performance Engineering team. To finish off my internship, I'm happy to announce some new changes with file I/O in the Firefox front-end.

Up until this point, most file I/O in chrome code has been done using the `OS.File` API [1]. This API has suited our needs for many years (10!), but the implementation raises some concerns about start-up performance, cache-contention, and memory usage (see bug 1231711 for more info).

This summer, a significant amount of work has been done to implement a new file API written in C++ which is not subject to these concerns. The new API, called `IOUtils`, is now available in the latest nightlies, and it is slated to replace `OS.File`. Work is ongoing to replace `OS.File` usages with analogous calls to `IOUtils` (see bug 986145), and new usages of `OS.File` should not be introduced. The new API is very similar to `OS.File`, but has some important ergonomic and performance improvements. You can find a migration guide here [2].

TL;DR if you need to read, write, or otherwise manipulate files from privileged JavaScript, please do so using methods on the new `IOUtils` global.

Questions? Check out the FAQ in the migration guide, or head over to the #perf channel on Matrix and we'll be happy to help out :)

Cheers,
Keefer

[1]: https://developer.mozilla.org/en-US/docs/Mozilla/JavaScript_code_modules/OSFile.jsm
[2]: https://docs.google.com/document/d/10_3dg0azLREP76esG5yWX4O8z4MJ0VUsplfPaTqhPxc/view

_______________________________________________
firefox-dev mailing list
firef...@mozilla.org
https://mail.mozilla.org/listinfo/firefox-dev

Mike Conley

unread,
Aug 28, 2020, 10:30:35 AM8/28/20
to Keefer Rourke, Firefox Dev
This is absolutely fantastic. I'm really excited to see us migrate to the new mechanism - thank you so much for your work this summer, Keefer!

David Teller

unread,
Aug 28, 2020, 10:50:37 AM8/28/20
to Keefer Rourke, firef...@mozilla.org
Ten years already? Gasp, OS.File was one of my first serious
contributions to Firefox :)

But yeah, it now needs to go. The replacement looks much better, thanks
a lot for taking care of that!

Cheers,
David

Brian Grinstead

unread,
Aug 28, 2020, 11:59:04 AM8/28/20
to Keefer Rourke, firefox-dev
Nice work! Thanks for putting the effort into documenting this, the migration doc looks great.

Brian

Nick Alexander

unread,
Aug 28, 2020, 12:25:57 PM8/28/20
to Brian Grinstead, Keefer Rourke, firefox-dev
Keefer, others,

On Fri, Aug 28, 2020 at 8:59 AM Brian Grinstead <bgrin...@mozilla.com> wrote:
Nice work! Thanks for putting the effort into documenting this, the migration doc looks great.

Piling on here -- the migration document is great.

Thanks!
Nick

Chris Peterson

unread,
Aug 28, 2020, 3:24:23 PM8/28/20
to Keefer Rourke, firef...@mozilla.org

On 8/28/2020 6:59 AM, Keefer Rourke wrote:
> I'm Keefer — this summer I had the amazing opportunity to intern with the Firefox Performance Engineering team. To finish off my internship, I'm happy to announce some new changes with file I/O in the Firefox front-end.
>
> Up until this point, most file I/O in chrome code has been done using the `OS.File` API [1]. This API has suited our needs for many years (10!), but the implementation raises some concerns about start-up performance, cache-contention, and memory usage (see bug 1231711 for more info).

Start-up performance and memory usage are two of the most common user
concerns, so thanks for taking on this important work!

Reply all
Reply to author
Forward
0 new messages