什么是渴望加载?

编程入门 行业动态 更新时间:2024-10-28 10:36:51
本文介绍了什么是渴望加载?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

什么是渴望加载?我用PHP/JS编写代码,但是更通用的答案就可以了.

What is eager loading? I code in PHP/JS but a more generalised answer will be just fine.

我看到了很多有关Java和Java的问题. Ruby,但我不懂这些语言,而且我很难阅读代码.首先我不知道该怎么办

I saw a lot of questions regarding Java & Ruby, but i don't know any of these languages, and I find it hard to read code. I don't know whats supposed to do in the first place

推荐答案

共有三个级别:

  • 急切加载:在询问时您可以完成所有操作.经典示例是将两个矩阵相乘.您进行所有计算.渴望加载;
  • 延迟加载:仅在需要时进行计算.在前面的示例中,在访问结果矩阵的元素之前,您无需进行任何计算;和
  • 急切加载:您可以在此处尝试预期用户的要求并对其进行预加载.
  • Eager loading: you do everything when asked. Classic example is when you multiply two matrices. You do all the calculations. That's eager loading;
  • Lazy loading: you only do a calculation when required. In the previous example, you don't do any calculations until you access an element of the result matrix; and
  • Over-eager loading: this is where you try and anticipate what the user will ask for and preload it.
  • 我希望在您看到的情况下这是有道理的.

    I hope that makes sense in the context you're seeing it.

    让我给您一个"Webby"示例.

    Let me give you a "Webby" example.

    想象一下一个页面,其中包含用于菜单项或导航的过渡图像.在此页面上可以通过三种方式加载图像:

    Imagine a page with rollover images like for menu items or navigation. There are three ways the image loading could work on this page:

  • 加载呈现页面之前所需的每张图像(渴望);
  • 仅加载页面上显示的图像,并在需要时加载其他图像(惰性);和
  • 仅在页面加载时加载显示的图像.页面加载后,将其他图像预加载到后台(如果需要)(急切).
  • Load every single image required before you render the page (eager);
  • Load only the displayed images on page load and load the others if/when they are required (lazy); and
  • Load only the displayed images on page load. After the page has loaded preload the other images in the background in case you need them (over-eager).
  • 有道理吗?

    更多推荐

    什么是渴望加载?

    本文发布于:2023-08-04 06:06:04,感谢您对本站的认可!
    本文链接:https://www.elefans.com/category/jswz/34/1293643.html
    版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
    本文标签:加载

    发布评论

    评论列表 (有 0 条评论)
    草根站长

    >www.elefans.com

    编程频道|电子爱好者 - 技术资讯及电子产品介绍!