惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

爱范儿
爱范儿
博客园_首页
W
WeLiveSecurity
S
Secure Thoughts
S
Security @ Cisco Blogs
Recent Commits to openclaw:main
Recent Commits to openclaw:main
Hugging Face - Blog
Hugging Face - Blog
www.infosecurity-magazine.com
www.infosecurity-magazine.com
H
Hacker News: Front Page
Project Zero
Project Zero
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
U
Unit 42
N
News and Events Feed by Topic
N
News and Events Feed by Topic
Hacker News - Newest:
Hacker News - Newest: "LLM"
Forbes - Security
Forbes - Security
T
Tor Project blog
I
Intezer
B
Blog
F
Full Disclosure
Security Archives - TechRepublic
Security Archives - TechRepublic
F
Fortinet All Blogs
Schneier on Security
Schneier on Security
T
Threat Research - Cisco Blogs
AI
AI
Google DeepMind News
Google DeepMind News
L
LINUX DO - 最新话题
Cloudbric
Cloudbric
L
Lohrmann on Cybersecurity
WordPress大学
WordPress大学
博客园 - 聂微东
雷峰网
雷峰网
P
Privacy International News Feed
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
PCI Perspectives
PCI Perspectives
Y
Y Combinator Blog
Spread Privacy
Spread Privacy
Simon Willison's Weblog
Simon Willison's Weblog
罗磊的独立博客
Vercel News
Vercel News
A
Arctic Wolf
The Register - Security
The Register - Security
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
Microsoft Azure Blog
Microsoft Azure Blog
H
Heimdal Security Blog
Know Your Adversary
Know Your Adversary
P
Proofpoint News Feed
C
Cybersecurity and Infrastructure Security Agency CISA
P
Proofpoint News Feed

博客园 - 新房客

iOS中判断Apple Pencil力度与手触摸 Electron,VUEJS3,Vite,TypesSript 开发环境配置 安卓2022.3.11环境配置 网上设置的跨域基本都失效了,新的设置方式 从模型坐标到屏幕坐标 群晖中使用Docker安装备份升级Gitlab vscode Typescript自动修复引入类时,引号设置 基于nodejs的阿里云DDNS服务,支持多网卡绑定 基于nodejs的游戏服务器 typescript 中 d.ts module 与 namespace 区别 使用vs code与microsoft edge调试webpack项目 解决Jenkins无法编译Egret5.0项目的问题 筛选git最后一次文件列表 推荐一个不错的plist拆解工具,untp - 新房客 - 博客园 vs code(egret wing) php配置与调试 关于 typings install 的使用 angular 引入 component 报错 angular2 环境配置 html5 js跨域
WebGL与Canvas的显存与内存使用分析
新房客 · 2021-04-26 · via 博客园 - 新房客

随笔~ 分析一下两者的内存使用。

按2048为基准,进行相关测试,现在移动设备基本都达到这个分辨率。

<canvas id="canvas" height="2048" width="2048"></canvas>

Canvas模式

如果是纯使用Canvas渲染,不涉及到WebGL,内存占用还是比较好计算的。

假设图片也是512大小,图片占用5125124= 1M。

Canvas宽高是2048,占用2048 * 2048 * 4 = 8MB 。

JavaScript堆栈占用看创建对象的情况而定,这里忽略不计。

最终整体的内存占用为9MB+。

WebGL模式

由于WebGL有中间层,本身的处理程序大小就占用4-10MB。

WebGL内存占用很大一部分是有浏览器决定,一般计算方式:

WebGL有抗锯齿(antialiased)设置,一般是2-16的范围,可以指定但最终还是有浏览器根据环境指定。下方以10为例:

渲染区(8MB * 10) + 副本缓存区(8MB * 10) + 图片(1MB)

Canvas(8MB) + ( GPU渲染区8MB)+ GPU缓存区(8MB * 10) + GPU处理堆栈(4-10MB) + JS堆栈 = 100MB以上。

常规情况下WebGL内存使用率是Canvas是10倍。 能力越大,消耗越大。 其实不需要太关注WebGL对内存的使用,在一般的低端模式下,会根据内存调节缓存区大小~

具体的数据就不贴了~ 自己记录一下~