<bdo id='7k5qA'></bdo><ul id='7k5qA'></ul>
  1. <i id='7k5qA'><tr id='7k5qA'><dt id='7k5qA'><q id='7k5qA'><span id='7k5qA'><b id='7k5qA'><form id='7k5qA'><ins id='7k5qA'></ins><ul id='7k5qA'></ul><sub id='7k5qA'></sub></form><legend id='7k5qA'></legend><bdo id='7k5qA'><pre id='7k5qA'><center id='7k5qA'></center></pre></bdo></b><th id='7k5qA'></th></span></q></dt></tr></i><div id='7k5qA'><tfoot id='7k5qA'></tfoot><dl id='7k5qA'><fieldset id='7k5qA'></fieldset></dl></div>

  2. <legend id='7k5qA'><style id='7k5qA'><dir id='7k5qA'><q id='7k5qA'></q></dir></style></legend>

  3. <tfoot id='7k5qA'></tfoot>

    <small id='7k5qA'></small><noframes id='7k5qA'>

      为网站使用内联/base64 图像比仅链接到硬文件快多少?

      How much faster is it to use inline/base64 images for a web site than just linking to the hard file?(为网站使用内联/base64 图像比仅链接到硬文件快多少?)
        <i id='rci03'><tr id='rci03'><dt id='rci03'><q id='rci03'><span id='rci03'><b id='rci03'><form id='rci03'><ins id='rci03'></ins><ul id='rci03'></ul><sub id='rci03'></sub></form><legend id='rci03'></legend><bdo id='rci03'><pre id='rci03'><center id='rci03'></center></pre></bdo></b><th id='rci03'></th></span></q></dt></tr></i><div id='rci03'><tfoot id='rci03'></tfoot><dl id='rci03'><fieldset id='rci03'></fieldset></dl></div>
          <bdo id='rci03'></bdo><ul id='rci03'></ul>
            • <tfoot id='rci03'></tfoot>

              <small id='rci03'></small><noframes id='rci03'>

                <tbody id='rci03'></tbody>
              • <legend id='rci03'><style id='rci03'><dir id='rci03'><q id='rci03'></q></dir></style></legend>

                本文介绍了为网站使用内联/base64 图像比仅链接到硬文件快多少?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                与简单地链接到服务器上的硬文件相比,使用 base64/line 显示图像要快多少?

                How much faster is it to use a base64/line to display images than opposed to simply linking to the hard file on the server?

                url(data:image/png;base64,.......)
                

                我无法找到任何类型的性能指标.

                I haven't been able to find any type of performance metrics on this.

                我有几个问题:

                • 您不再获得缓存的好处
                • base64 的大小不是比 PNG/JPEG 文件大很多吗?

                让我们将更快"定义为:用户看到完整呈现的 HTML 网页所需的时间

                推荐答案

                更快"是一个很难回答的问题,因为有很多可能的解释和情况:

                'Faster' is a hard thing to answer because there are many possible interpretations and situations:

                Base64 编码会将图像扩展三分之一,这将增加带宽利用率.另一方面,将它包含在文件中将删除另一个 GET 往返服务器.因此,与使用不同的图像文件相比,具有高吞吐量但低延迟的管道(例如卫星互联网连接)可能会更快地加载具有内联图像的页面.即使在我的(农村、慢速)DSL 线路上,需要多次往返的站点也比那些相对较大但只需要几个 GET 的站点加载时间要长得多.

                Base64 encoding will expand the image by a third, which will increase bandwidth utilization. On the other hand, including it in the file will remove another GET round trip to the server. So, a pipe with great throughput but poor latency (such as a satellite internet connection) will likely load a page with inlined images faster than if you were using distinct image files. Even on my (rural, slow) DSL line, sites that require many round trips take a lot longer to load than those that are just relatively large but require only a few GETs.

                如果您对每个请求的源文件进行 base64 编码,您将使用更多 CPU,破坏您的数据缓存等,这可能会损害您的服务器响应时间.(当然你总是可以使用 memcached 之类的来解决这个问题).

                If you do the base64 encoding from the source files with each request, you'll be using up more CPU, thrashing your data caches, etc, which might hurt your servers response time. (Of course you can always use memcached or such to resolve that problem).

                这样做当然会阻止大多数形式的缓存,如果经常查看图像,这可能会造成很大的伤害 - 例如,显示在每个页面上的徽标,通常可以由浏览器缓存(或代理缓存像鱿鱼或其他东西)并要求每月一次.它还将阻止 Web 服务器使用 sendfile(2) 等内核 API 提供静态文件的许多优化.

                Doing this will of course prevent most forms of caching, which could hurt a lot if the image is viewed often - say, a logo that is displayed on every page, which could normally be cached by the browser (or a proxy cache like squid or whatever) and requested once a month. It will also prevent the many many optimizations web servers have for serving static files using kernel APIs like sendfile(2).

                基本上,这样做在某些情况下会有所帮助,而在其他情况下会受到伤害.您需要确定哪些情况对您很重要,然后才能真正确定这对您来说是否值得.

                Basically, doing this will help in certain situations, and hurt in others. You need to identify which situations are important to you before you can really figure out if this is a worthwhile trick for you.

                这篇关于为网站使用内联/base64 图像比仅链接到硬文件快多少?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                相关文档推荐

                Plot data in website from multiple csv file(从多个 csv 文件中绘制网站中的数据)
                Content Service for Google Apps Script returning HTML instead of JSON(返回 HTML 而不是 JSON 的 Google Apps 脚本的内容服务)
                Javascript Confirm popup Yes, No button instead of OK and Cancel(Javascript 确认弹出窗口是,否按钮而不是确定和取消)
                Opensource/free HTML5/CSS3/JavaScript IDE?(开源/免费 HTML5/CSS3/JavaScript IDE?)
                jump to CSS selector in a css file from the HTML file in Vim using a single keystroke(使用单次击键从 Vim 中的 HTML 文件跳转到 CSS 文件中的 CSS 选择器)
                Is there a good in-browser code editor?(有没有好的浏览器内代码编辑器?)

                    <tbody id='4gCY6'></tbody>

                • <small id='4gCY6'></small><noframes id='4gCY6'>

                    • <bdo id='4gCY6'></bdo><ul id='4gCY6'></ul>
                    • <tfoot id='4gCY6'></tfoot>

                        <i id='4gCY6'><tr id='4gCY6'><dt id='4gCY6'><q id='4gCY6'><span id='4gCY6'><b id='4gCY6'><form id='4gCY6'><ins id='4gCY6'></ins><ul id='4gCY6'></ul><sub id='4gCY6'></sub></form><legend id='4gCY6'></legend><bdo id='4gCY6'><pre id='4gCY6'><center id='4gCY6'></center></pre></bdo></b><th id='4gCY6'></th></span></q></dt></tr></i><div id='4gCY6'><tfoot id='4gCY6'></tfoot><dl id='4gCY6'><fieldset id='4gCY6'></fieldset></dl></div>
                          <legend id='4gCY6'><style id='4gCY6'><dir id='4gCY6'><q id='4gCY6'></q></dir></style></legend>