<div dir="ltr">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!<br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, 28 Aug 2020 at 10:10, Keefer Rourke <<a href="mailto:krourke@mozilla.com">krourke@mozilla.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hi folks,<br>
<br>
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.<br>
<br>
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).<br>
<br>
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].<br>
<br>
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.<br>
<br>
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 :)<br>
<br>
Cheers,<br>
Keefer<br>
<br>
[1]: <a href="https://developer.mozilla.org/en-US/docs/Mozilla/JavaScript_code_modules/OSFile.jsm" rel="noreferrer" target="_blank">https://developer.mozilla.org/en-US/docs/Mozilla/JavaScript_code_modules/OSFile.jsm</a><br>
[2]: <a href="https://docs.google.com/document/d/10_3dg0azLREP76esG5yWX4O8z4MJ0VUsplfPaTqhPxc/view" rel="noreferrer" target="_blank">https://docs.google.com/document/d/10_3dg0azLREP76esG5yWX4O8z4MJ0VUsplfPaTqhPxc/view</a><br>
<br>
_______________________________________________<br>
firefox-dev mailing list<br>
<a href="mailto:firefox-dev@mozilla.org" target="_blank">firefox-dev@mozilla.org</a><br>
<a href="https://mail.mozilla.org/listinfo/firefox-dev" rel="noreferrer" target="_blank">https://mail.mozilla.org/listinfo/firefox-dev</a><br>
</blockquote></div>