Comments (4)
@wentworthzheng
fis内置的插件,打包不支持重复文件。如果文件允许重复,读取map.json的那个框架的算法会很复杂,性能比较差。
from fis.
@wentworthzheng
举个例子,比如你有a、b、c、d、e、f这6个资源,打包方式是:
p0 : a+b+d
p1 : a+b+e+f
当我页面需要用 a、b、d、e的时候,可选的方案有:
方案1:p0 + e
方案2:p1 + d
都是两个请求,然后后端框架还要计算带宽量。
虽然理论上,可重复打包能进行更细致的打包结果控制,但这种策略有些算法上的缺陷,在运行时需要枚举所有可能的组合方案,是一个动态规划问题,fis曾经是这样的算法,后来发现这样做得不偿失,就放弃了,改用更简单的打包去重策略。
from fis.
@wentworthzheng
此外,可重复包通常因为这样类似的需求:
我有A、B两个页面,A页面用了a、b、c,B页面用了a、b、d。
我希望:
A页面引用p0(a+b+c)包,B页面引用p1(a+b+c)包,这样每个页面都只有一个请求了。
符合雅虎14条军规中关于减少http请求的要求。
这种说法具有一定的合理性,我们单独看A或者B页面,或许能得到这样的结论,如果A、B两个页面是完全没有联系,彼此没有任何可达性,这样的结论比较合理。但如果AB在一个网站内,并且相互可达(用户访问A或B页面之后,可能在短时间内再访问B或A页面),那么我们或许应该让AB页面共享a+b资源的浏览器缓存,而使用这样的打包策略:
p0 = a + b;
A页面 = p0 + c;
B页面 = p0 + d;
虽然每个页面都有两个请求,但用户在网站内浏览时,可以共享p0资源,而c、d每个页面单独下载,没有浪费的带宽。这个道理符合雅虎14条军规中的“使用缓存”相关要求。
from fis.
@wentworthzheng
综上所述,从资源管理算法到统计层面的缓存利用率,不重复打包策略具有简洁、高效的优势,所以fis比较倾向这种策略,虽然可能不是最完美的结果。
from fis.
Related Issues (20)
- css, js 文件未压缩 HOT 4
- fis构建,有依赖关系的md5值不一致
- fisp迁移到fis3
- Fis2 静态资源文件打包生成MD5戳不稳定 HOT 3
- FIS2编译的map.json里面没有内容了
- 经过FIS压缩后,JS里面的内容中的一个'()'被删掉了,导致JS语法错误 HOT 5
- fis 使用babel 编译无法兼容到ie 8 HOT 1
- 请问如何在部署的文件内容里里加上特定内容,比如在每个文件头部加上”部署于2018.6.23“类似的内容?
- fis2项目 pngquant压缩报错 HOT 3
- 未捕获异常'SmartyException' HOT 3
- linux下的fis 如何配置插件的位置?有 [ERROR] unable to load plugin [fis-parser-tomd]报错【已解决】
- 同样的工程linux下fis启动后,打开的页面没有渲染 ,而windows下却会渲染? HOT 2
- fis-conf.js的配置中fis.config.set('context_path',"/open")起什么作用?急,在线等! HOT 1
- 请问fis能对打包的文件重新命名么 HOT 3
- 使用node版本的fis-receiver,fis release时报错 ——我会了
- 添加md5戳后,文件路径会修改成绝对路径,可否保持原来的相对路径?
- Make fis3 default support typescript
- 日志
- fis打包后,引入js的属性不生效
- fis2 --pack后引用的JS部分代码被改变如何解决 HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from fis.