NSCache官方文档学习

基本阐述

1、A mutable collection you use to temporarily store transient key-value pairs that are subject to eviction when resources are low.

  • t r a n s i e n t \color{red}{transient} transient 短暂的路过的
  • e v i c t i o n \color{red}{eviction} eviction:逐出,赶出,收回
  • 这是一个临时存储键值对的容器,在资源(主要是内存)低的时候存储的值会被清除。

2、最近在学习SDWebImage框架,学习到了NSCache,就单独拎出来学习学习。

Overview概要

1、The NSCache class incorporates various auto-eviction policies, which ensure that a cache doesn’t use too much of the system’s memory. If memory is needed by other applications, these policies remove some items from the cache, minimizing its memory footprint.

  • i n c o r p o r a t e s \color{red}{incorporates} incorporates: 包含
  • i a u t o − e v i c t i o n \color{red}{iauto-eviction} iautoeviction:自动清除
  • NSCache包含变化的字移除策略,这种策略确保一个cache不使用过多的系统内存,如果其他应用需要内存,这些(定好的)策略会从cache中移除一些项目,降低它的内存足迹。

2、You can add, remove, and query items in the cache from different threads without having to lock the cache yourself.

  • 从不同线程添加、移除、查询项目,不会死锁cache,也就是线程安全。

3、Unlike an N S M u t a b l e D i c t i o n a r y \color{red}{NSMutableDictionary} NSMutableDictionary object, a cache does not copy the key objects that are put into it.

  • 这句话的意思就是较NSMutableDictionary相比,cache没有字典的拷贝,字典拷贝应该是value,这点我可能认识是错误的。

4、You typically use NSCache objects to temporarily store objects with transient data that are expensive to create. Reusing these objects can provide performance benefits, because their values do not have to be recalculated. However, the objects are not critical to the application and can be discarded if memory is tight. If discarded, their values will have to be recomputed again when needed.

  • that are expensive to create 我理解就是这些数据创建起来比较费劲
  • 意思是:你通常用NSCache对象来临时短暂存储一些比较难创建的数据,重用这些数据能提高性能,因为这些值不需要被重新计算。然而,这些对象对你的应用来说不是非常重要,如果内存紧张,能被抛弃,如果这些对象被废弃了,这些值在需要的时候被重新计算。

5、Objects that have subcomponents that can be discarded when not being used can adopt the N S D i s c a r d a b l e C o n t e n t p r o t o c o l \color{red}{NSDiscardableContent protocol} NSDiscardableContentprotocol to improve cache eviction behavior. By default, N S D i s c a r d a b l e C o n t e n t \color{red}{NSDiscardableContent} NSDiscardableContent objects in a cache are automatically removed if their content is discarded, although this automatic removal policy can be changed. If an NSDiscardableContent object is put into the cache, the cache calls d i s c a r d C o n t e n t I f P o s s i b l e ( ) \color{red}{discardContentIfPossible()} discardContentIfPossible() on it upon its removal.

  • 这里详细说明了一些废弃政策。
  • 遵守NSDiscardableContent协议
  • to improve cache eviction behavior改善缓存废弃行为
  • 调用discardContentIfPossible移除NSDiscardableContent object

方法学习

  • protocol NSDiscardableContent
    You implement this protocol when a class’s objects have subcomponents that can be discarded when not being used, thereby giving an application a smaller memory footprint.
### 不同开源视觉大模型的比较 #### OpenCV OpenCV 是一个广泛使用的计算机视觉库,旨在为计算机视觉应用提供通用基础设施并加速机器感知技术在商业产品中的应用。该库拥有超过2500个优化算法,涵盖了经典和前沿的计算机视觉及机器学习算法[^1]。 #### AutoRT 数据集特性 AutoRT 的数据展示了更高的视觉多样性,尤其是在更为多样的环境下运行时表现尤为明显。具体来说,在图5中展示的是对AutoRT视觉多样性的可视化分析,表明远程操作(Teleop)数据的效果最好,因为这些数据远离先前的数据分布,具有更大的距离权重[^2]。 #### 深度强化学习框架下的视觉模型 深度强化学习近年来已经成功应用于多个领域,包括但不限于电子游戏、棋类游戏以及连续控制等问题。在此背景下发展起来的一些视觉模型不仅依赖于深度神经网络的强大能力来处理图像识别任务,还结合了强化学习的思想来进行决策制定。例如,某些工作提出了新的后继表示架构,减少了参数数量从而促进了大型动作空间内的模型收敛,并允许通过模仿学习预训练后再用RL进行微调的方式提高性能[^3]。 #### 预训练抓取模型的应用 对于特定用途机器人而言,预先训练好的抓取模型可以直接用于移动操纵场景下开放词汇表范围内的物体抓取任务,无需额外训练或调整即可实现即插即用的功能扩展。这类预训练模型通常是在大量数据基础上构建而成,具备良好的泛化能力和适应性[^4]。 综上所述,不同类型的开源视觉大模型各有侧重:有的专注于基础功能的支持和服务;有的则强调环境交互过程中的自适应性和灵活性;还有些则是为了满足特定应用场景的需求而设计开发出来的专用工具包。选择合适的模型取决于具体的项目需求和技术背景考量因素。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值