{"id":33901,"date":"2019-10-31T21:55:19","date_gmt":"2019-10-31T18:55:19","guid":{"rendered":"https:\/\/prohoster.info\/blog\/cloudflare-mozilla-i-facebook-razvivayut-binaryast-dlya-uskoreniya-zagruzki-javascript\/"},"modified":"2019-10-31T21:55:19","modified_gmt":"2019-10-31T18:55:19","slug":"cloudflare-mozilla-i-facebook-razvivayut-binaryast-dlya-uskoreniya-zagruzki-javascript","status":"publish","type":"post","link":"https:\/\/prohoster.info\/en\/blog\/news\/cloudflare-mozilla-i-facebook-razvivayut-binaryast-dlya-uskoreniya-zagruzki-javascript","title":{"rendered":"Cloudflare, Mozilla, and Facebook are developing BinaryAST to speed up JavaScript loading","gt_translate_keys":[{"key":"rendered","format":"text"}]},"content":{"rendered":"<p>Engineers from Cloudflare, Mozilla, Facebook, and Bloomberg <noindex><a rel=\"nofollow\" href=\"https:\/\/blog.cloudflare.com\/binary-ast\/\">by engineers from Intel. They modified the existing codebase related to Thunderbolt \u2014 around two thousand lines.<\/a><\/noindex> new format <noindex><a rel=\"nofollow\" href=\"https:\/\/github.com\/tc39\/proposal-binary-ast\">BinaryAST<\/a><\/noindex>  to accelerate the delivery and processing of JavaScript code when opening websites in browsers. BinaryAST offloads the parsing phase to the server and delivers an already formed abstract syntax tree (<noindex><a rel=\"nofollow\" href=\"https:\/\/ru.wikipedia.org\/wiki\/%D0%90%D0%B1%D1%81%D1%82%D1%80%D0%B0%D0%BA%D1%82%D0%BD%D0%BE%D0%B5_%D1%81%D0%B8%D0%BD%D1%82%D0%B0%D0%BA%D1%81%D0%B8%D1%87%D0%B5%D1%81%D0%BA%D0%BE%D0%B5_%D0%B4%D0%B5%D1%80%D0%B5%D0%B2%D0%BE\">AST<\/a><\/noindex>). When receiving BinaryAST, the browser can immediately move to the compilation stage, bypassing the parsing of the JavaScript source code. <\/p>\n<p>For testing <noindex><a rel=\"nofollow\" href=\"https:\/\/github.com\/binast\/binjs-ref\">has been prepared<\/a><\/noindex> a reference implementation provided under an MIT license. Parsing uses components of Node.js, and the code for optimizing and generating the AST is written in Rust. On the browser side, support for<br \/>\nBinaryAST is already available in <noindex><a rel=\"nofollow\" href=\"https:\/\/www.mozilla.org\/en-US\/firefox\/channel\/desktop\/#nightly\">nightly builds<\/a><\/noindex> Firefox. The encoder in BinaryAST can be applied at both the level of the site's toolset and for packaging scripts from external sites on the proxy or content delivery network side. The standardization process for BinaryAST has already begun by the <noindex><a rel=\"nofollow\" href=\"https:\/\/tc39.github.io\/\">ECMA TC39<\/a><\/noindex>, after which the format will be able to coexist with existing methods of content compression, such as gzip and brotli. <\/p>\n<p><center><noindex><a rel=\"nofollow\" href=\"https:\/\/blog.cloudflare.com\/content\/images\/2019\/05\/without-binAST.png\"><img decoding=\"async\" alt=\"Cloudflare, Mozilla, and Facebook are developing BinaryAST to speed up JavaScript loading\" src=\"\/wp-content\/uploads\/2019\/05\/fdb78c6b073295f42c6ed83e0ba73dd1.png\" style=\"display:block;margin: 0 auto;\" \/><\/a><\/noindex><\/center><br \/>\n<center><noindex><a rel=\"nofollow\" href=\"https:\/\/blog.cloudflare.com\/content\/images\/2019\/05\/With-BinAST.png\"><img decoding=\"async\" alt=\"Cloudflare, Mozilla, and Facebook are developing BinaryAST to speed up JavaScript loading\" src=\"\/wp-content\/uploads\/2019\/05\/457e5f127c81b8708cdc04ba0176a636.png\" style=\"display:block;margin: 0 auto;\" \/><\/a><\/noindex><\/center><\/p>\n<p>A significant amount of time spent processing JavaScript is taken up by the loading and parsing phase of the code. Considering that the amount of JavaScript loaded on many popular websites approaches 10 MB (for example, LinkedIn \u2014 7.2 MB, Facebook \u2014 7.1 MB, Gmail \u2014 3.9 MB), the initial processing of JavaScript introduces substantial delays. The parsing stage on the browser side is also slowed down due to the inability to fully construct the AST on the fly as the code loads (the browser has to wait for the completion of code blocks, such as the end of functions, to obtain necessary information missing for parsing the current elements).<\/p>\n<p>Part of the problem is being addressed by distributing the code in minimized and compressed form, as well as through the caching of the generated bytecode by the browser. On modern sites, the code is updated quite frequently, thus caching only partially solves the problem. WebAssembly could be a solution, but it requires explicit typing in the code and is not well-suited for speeding up the processing of already existing JavaScript code. <\/p>\n<p>An alternative is to deliver pre-compiled bytecode instead of JavaScript scripts, but browser engine developers oppose this because third-party bytecode is difficult to verify, direct processing can lead to web fragmentation, additional security threats arise, and a universal bytecode format needs to be developed.<\/p>\n<p>BinaryAST allows integration into the current code development and delivery model without creating new bytecode or modifying the JavaScript language. The size of data in the BinaryAST format is comparable to that of compressed minified JavaScript code, and processing speed increases significantly due to the elimination of the source text parsing phase. Additionally, the format allows for bytecode compilation as BinaryAST is loaded, without waiting for all data to be fully received. Furthermore, server-side parsing allows the removal of unused functions and extraneous code from the delivered BinaryAST representation, which consumes time both for parsing and excess traffic when done in the browser.<\/p>\n<p>A feature of BinaryAST is also the ability to restore readable JavaScript that does not exactly match the original version, but is semantically equivalent and includes the same variable and function names (BinaryAST preserves names but does not retain position information, formatting, and comments). The downside, however, is the emergence of new attack vectors, but developers believe they are significantly smaller and more controllable than when using alternatives like bytecode distribution.<\/p>\n<p>Tests on the code of facebook.com showed that 10-15% of CPU resources are spent on parsing JavaScript, and more time is spent on parsing than on bytecode generation and initial code formation for JIT. In the SpiderMonkey engine, the total AST construction time takes 500-800 ms, and the use of BinaryAST has reduced this figure by 70-90%.<br \/>\nOverall, for most web frameworks, using BinaryAST reduces JavaScript parsing time by 3-10% in non-optimized mode and by 90-97% when the mode for ignoring unused functions is enabled.<br \/>\nWhen executing a test JavaScript set of 1.2 MB, the use of BinaryAST reduced the startup time from 338 to 314 ms on a desktop system (Intel i7) and from 2019 to 1455 ms on a mobile device (HTC One M8).<\/p>\n<p><noindex><a rel=\"nofollow\" name=\"link\"><\/a><\/noindex><\/p>\n<p>Source: <a \ncontent=\"nofollow\" rel=\"nofollow\" href=\"https:\/\/www.opennet.ru\/opennews\/art.shtml?num=50701\">opennet.ru<\/a><\/p>","protected":false,"gt_translate_keys":[{"key":"rendered","format":"html"}]},"excerpt":{"rendered":"<p>\u0418\u043d\u0436\u0435\u043d\u0435\u0440\u044b \u0438\u0437 \u043a\u043e\u043c\u043f\u0430\u043d\u0438\u0439 Cloudflare, Mozilla, Facebook \u0438 Bloomberg \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0438\u043b\u0438 \u043d\u043e\u0432\u044b\u0439 \u0444\u043e\u0440\u043c\u0430\u0442 BinaryAST \u0434\u043b\u044f \u0443\u0441\u043a\u043e\u0440\u0435\u043d\u0438\u044f \u0434\u043e\u0441\u0442\u0430\u0432\u043a\u0438 \u0438 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 JavaScript \u043a\u043e\u0434\u0430 \u043f\u0440\u0438 \u043e\u0442\u043a\u0440\u044b\u0442\u0438\u0438 \u0441\u0430\u0439\u0442\u043e\u0432 \u0432 \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0435. BinaryAST \u0432\u044b\u043d\u043e\u0441\u0438\u0442 \u0444\u0430\u0437\u0443 \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u0440\u0430\u0437\u0431\u043e\u0440\u0430 \u043d\u0430 \u0441\u0442\u043e\u0440\u043e\u043d\u0443 \u0441\u0435\u0440\u0432\u0435\u0440\u0430 \u0438 \u043f\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0443\u0436\u0435 \u0441\u0444\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0435 \u0430\u0431\u0441\u0442\u0440\u0430\u043a\u0442\u043d\u043e\u0435 \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0447\u0435\u0441\u043a\u043e\u0435 \u0434\u0435\u0440\u0435\u0432\u043e (AST). \u041f\u0440\u0438 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0438 BinaryAST \u0431\u0440\u0430\u0443\u0437\u0435\u0440 \u0441\u0440\u0430\u0437\u0443 \u043c\u043e\u0436\u0435\u0442 \u043f\u0435\u0440\u0435\u0439\u0442\u0438 \u043d\u0430 \u0441\u0442\u0430\u0434\u0438\u044e \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u0438, \u043c\u0438\u043d\u0443\u044f \u043f\u0430\u0440\u0441\u0438\u043d\u0433 \u0438\u0441\u0445\u043e\u0434\u043d\u043e\u0433\u043e \u043a\u043e\u0434\u0430 JavaScript. [&hellip;]<\/p>\n","protected":false,"gt_translate_keys":[{"key":"rendered","format":"html"}]},"author":1,"featured_media":25564,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[702],"tags":[],"class_list":["post-33901","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-news"],"aioseo_notices":[],"aioseo_head":"\n\t\t<!-- All in One SEO 5.0.2 - aioseo.com -->\n\t<meta name=\"description\" content=\"\u0418\u043d\u0436\u0435\u043d\u0435\u0440\u044b \u0438\u0437 \u043a\u043e\u043c\u043f\u0430\u043d\u0438\u0439 Cloudflare, Mozilla, Facebook \u0438 Bloomberg \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0438\u043b\u0438 \u043d\u043e\u0432\u044b\u0439 \u0444\u043e\u0440\u043c\u0430\u0442\" \/>\n\t<meta name=\"robots\" content=\"max-image-preview:large\" \/>\n\t<meta name=\"author\" content=\"Yuri Gagarin\"\/>\n\t<link rel=\"canonical\" href=\"https:\/\/prohoster.info\/en\/blog\/news\/cloudflare-mozilla-i-facebook-razvivayut-binaryast-dlya-uskoreniya-zagruzki-javascript\" \/>\n\t<meta name=\"generator\" content=\"All in One SEO (AIOSEO) 5.0.2\" \/>\n\t\t<meta property=\"og:locale\" content=\"en_US\" \/>\n\t\t<meta property=\"og:site_name\" content=\"ProHoster | \u041a\u0443\u043f\u0438\u0442\u044c \u043d\u0430\u0434\u0435\u0436\u043d\u044b\u0439 \u0445\u043e\u0441\u0442\u0438\u043d\u0433 \u0434\u043b\u044f \u0441\u0430\u0439\u0442\u043e\u0432 \u0441 \u0437\u0430\u0449\u0438\u0442\u043e\u0439 \u043e\u0442 DDoS, VPS VDS \u0441\u0435\u0440\u0432\u0435\u0440\u044b\" \/>\n\t\t<meta property=\"og:type\" content=\"article\" \/>\n\t\t<meta property=\"og:title\" content=\"\ud83e\udd47Cloudflare, Mozilla \u0438 Facebook \u0440\u0430\u0437\u0432\u0438\u0432\u0430\u044e\u0442 BinaryAST \u0434\u043b\u044f \u0443\u0441\u043a\u043e\u0440\u0435\u043d\u0438\u044f \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0438 JavaScript | ProHoster\" \/>\n\t\t<meta property=\"og:description\" content=\"\u0418\u043d\u0436\u0435\u043d\u0435\u0440\u044b \u0438\u0437 \u043a\u043e\u043c\u043f\u0430\u043d\u0438\u0439 Cloudflare, Mozilla, Facebook \u0438 Bloomberg \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0438\u043b\u0438 \u043d\u043e\u0432\u044b\u0439 \u0444\u043e\u0440\u043c\u0430\u0442\" \/>\n\t\t<meta property=\"og:url\" content=\"https:\/\/prohoster.info\/en\/blog\/news\/cloudflare-mozilla-i-facebook-razvivayut-binaryast-dlya-uskoreniya-zagruzki-javascript\" \/>\n\t\t<meta property=\"og:image\" content=\"https:\/\/prohoster.info\/wp-content\/uploads\/2021\/11\/logo-350.jpg\" \/>\n\t\t<meta property=\"og:image:secure_url\" content=\"https:\/\/prohoster.info\/wp-content\/uploads\/2021\/11\/logo-350.jpg\" \/>\n\t\t<meta property=\"og:image:width\" content=\"350\" \/>\n\t\t<meta property=\"og:image:height\" content=\"350\" \/>\n\t\t<meta property=\"article:published_time\" content=\"2019-10-31T18:55:19+00:00\" \/>\n\t\t<meta property=\"article:modified_time\" content=\"2019-10-31T18:55:19+00:00\" \/>\n\t\t<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/prohoster\" \/>\n\t\t<meta property=\"article:author\" content=\"https:\/\/www.facebook.com\/prohoster\" \/>\n\t\t<!-- All in One SEO -->\n\n","aioseo_head_json":{"title":"\ud83e\udd47Cloudflare, Mozilla, and Facebook are developing BinaryAST to accelerate JavaScript loading | ProHoster","description":"Engineers from Cloudflare, Mozilla, Facebook, and Bloomberg have proposed a new format","canonical_url":"https:\/\/prohoster.info\/en\/blog\/news\/cloudflare-mozilla-i-facebook-razvivayut-binaryast-dlya-uskoreniya-zagruzki-javascript","robots":"max-image-preview:large","keywords":"","webmasterTools":{"miscellaneous":""},"schema":null,"og:locale":"en_US","og:site_name":"ProHoster | \u041a\u0443\u043f\u0438\u0442\u044c \u043d\u0430\u0434\u0435\u0436\u043d\u044b\u0439 \u0445\u043e\u0441\u0442\u0438\u043d\u0433 \u0434\u043b\u044f \u0441\u0430\u0439\u0442\u043e\u0432 \u0441 \u0437\u0430\u0449\u0438\u0442\u043e\u0439 \u043e\u0442 DDoS, VPS VDS \u0441\u0435\u0440\u0432\u0435\u0440\u044b","og:type":"article","og:title":"\ud83e\udd47Cloudflare, Mozilla \u0438 Facebook \u0440\u0430\u0437\u0432\u0438\u0432\u0430\u044e\u0442 BinaryAST \u0434\u043b\u044f \u0443\u0441\u043a\u043e\u0440\u0435\u043d\u0438\u044f \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0438 JavaScript | ProHoster","og:description":"\u0418\u043d\u0436\u0435\u043d\u0435\u0440\u044b \u0438\u0437 \u043a\u043e\u043c\u043f\u0430\u043d\u0438\u0439 Cloudflare, Mozilla, Facebook \u0438 Bloomberg \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0438\u043b\u0438 \u043d\u043e\u0432\u044b\u0439 \u0444\u043e\u0440\u043c\u0430\u0442","og:url":"https:\/\/prohoster.info\/en\/blog\/news\/cloudflare-mozilla-i-facebook-razvivayut-binaryast-dlya-uskoreniya-zagruzki-javascript","og:image":"https:\/\/prohoster.info\/wp-content\/uploads\/2021\/11\/logo-350.jpg","og:image:secure_url":"https:\/\/prohoster.info\/wp-content\/uploads\/2021\/11\/logo-350.jpg","og:image:width":350,"og:image:height":350,"article:published_time":"2019-10-31T18:55:19+00:00","article:modified_time":"2019-10-31T18:55:19+00:00","article:publisher":"https:\/\/www.facebook.com\/prohoster","article:author":"https:\/\/www.facebook.com\/prohoster"},"aioseo_meta_data":{"post_id":"33901","title":null,"description":null,"keywords":null,"keyphrases":null,"primary_term":null,"canonical_url":null,"og_title":null,"og_description":null,"og_object_type":"default","og_image_type":"default","og_image_url":null,"og_image_width":null,"og_image_height":null,"og_image_custom_url":null,"og_image_custom_fields":null,"og_video":null,"og_custom_url":null,"og_article_section":null,"og_article_tags":null,"twitter_use_og":false,"twitter_card":"default","twitter_image_type":"default","twitter_image_url":null,"twitter_image_custom_url":null,"twitter_image_custom_fields":null,"twitter_title":null,"twitter_description":null,"schema":{"blockGraphs":[],"customGraphs":[],"default":{"data":{"Article":[],"Course":[],"Dataset":[],"FAQPage":[],"Movie":[],"Person":[],"Product":[],"ProductReview":[],"Car":[],"Recipe":[],"Service":[],"SoftwareApplication":[],"WebPage":[]},"graphName":"","isEnabled":true},"graphs":[]},"schema_type":null,"schema_type_options":null,"pillar_content":false,"robots_default":true,"robots_noindex":false,"robots_noarchive":false,"robots_nosnippet":false,"robots_nofollow":false,"robots_noimageindex":false,"robots_noodp":false,"robots_notranslate":false,"robots_max_snippet":null,"robots_max_videopreview":null,"robots_max_imagepreview":"large","priority":null,"frequency":null,"local_seo":null,"seo_analyzer_scan_date":"2026-01-21 17:09:19","breadcrumb_settings":null,"limit_modified_date":false,"reviewed_by":null,"ai":null,"created":"2021-03-01 02:31:22","updated":"2026-01-21 17:09:19","focus_keyword":null,"additional_keywords":null,"truseo_locale":null},"gt_translate_keys":[{"key":"link","format":"url"}],"_links":{"self":[{"href":"https:\/\/prohoster.info\/en\/wp-json\/wp\/v2\/posts\/33901","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/prohoster.info\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/prohoster.info\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/prohoster.info\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/prohoster.info\/en\/wp-json\/wp\/v2\/comments?post=33901"}],"version-history":[{"count":0,"href":"https:\/\/prohoster.info\/en\/wp-json\/wp\/v2\/posts\/33901\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/prohoster.info\/en\/wp-json\/wp\/v2\/media\/25564"}],"wp:attachment":[{"href":"https:\/\/prohoster.info\/en\/wp-json\/wp\/v2\/media?parent=33901"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/prohoster.info\/en\/wp-json\/wp\/v2\/categories?post=33901"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/prohoster.info\/en\/wp-json\/wp\/v2\/tags?post=33901"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}