Comments (4)
Hi @Stranger6667, thank you for the proposal!
About Performance:
pynliner
is really slow and I have ever encountered performance issue when render templates/email/feed_analysis.html.mako. The template contains a very large table, and need inline css for each cell. So the render process is very slow, and the final html is very large, which also cause email app rendering very slow.
My solution is pre inline css on mako template and cache the template, then do mako rendering. So only need inline css once, and reuse the inlined template. FYI: email_template.py
And to avoid too large html, I have to use css classes instead of inline styles.
it might require changing the order of rendering for mako templates (pynliner doesn't transform Mako's syntax as css-inline does)
It's not suitable for my cases to change rendering order, as described above.
About ARM wheel
ARM64 is required for rssant. Not sure whether it's hard to install from source or not. It's possible to build ARM64 wheel from source via docker multi-stage build.
from rssant.
@guyskk Thank you for providing the context!
Re ARM64 wheel: I added wheels for Python 3.8+ on macOS ARM64 and some more platforms including manylinux aarch64, musllinux aarch64 etc. Hopefully, it satisfies the requirements :) Let me know if it is not sufficient, and rssant needs e.g. Python 3.7 on ARM64
Re performance: Pre-inlining is a neat trick indeed! :) I tried to render that template with some randomly generated data (see below) and post-inlining with pynliner
takes ~2.3s vs ~8.2ms with css-inline
. Though, with pre-inlining, it becomes much or less irrelevant, as switching to post-inlining will give a net-negative effect on performance in any case :) Probably it is something for me to consider - maybe css-inline
may support templated input one day :)
Details on data generation
from hypothesis import provisional as pr, strategies as st, settings, given
... # import `Feed` from feed_analysis here - locally I copied the relevant definitions
feeds = st.builds(
Feed,
id=st.integers(min_value=1),
domain=pr.domains(),
status=st.sampled_from(["pending", "updating", "ready", "error", "discard"]),
use_proxy=st.booleans(),
response_status=st.integers(min_value=200, max_value=500),
freeze_level=st.integers(min_value=1, max_value=10)
)
out = []
@given(feeds)
@settings(max_examples=10000)
def generate(x):
out.append(x)
# calling generate() will add 10000 random `Feed` instances to `out`
# Then generating snapshots from it via `compute_snapshot`, and passing them to `compute_report`
So, effectively it looks like the only way to use css-inline
at the moment means a performance hit due to unconditional post-inlining (though, maybe template itself can be re-arranged to support css-inline
, but it is too much for this change). premailer
also malformed the template :( Let me know if there is anything I can do on my side here, and thank you for consideration :)
from rssant.
@Stranger6667 Seems nothing needs to be done for inlining css in rssant project.
If you have interest in high performance project, maybe take a look at this optics science project:
from rssant.
Thanks, @guyskk ! :)
from rssant.
Related Issues (20)
- docker部署出错 HOT 1
- 列表可以不跳回最新文章位置吗? HOT 1
- rss 源长时间未更新 HOT 2
- 少数网站不能订阅,获取全文 HOT 2
- 希望能够添加收藏到 pocket 的功能 HOT 2
- 增加快捷键等 HOT 2
- 删除订阅界面下方的链接 HOT 2
- 部署的时候增加代理的部署 HOT 2
- 部署启动后无法修改密码 HOT 3
- [bug] 本地rss无法获取? FEED_PRIVATE_ADDRESS_ERROR HOT 5
- [bug?] 使用 rssant 订阅 https://rsshub.app/rsshub/routes 显示 -206 FEED_CONNECTION_RESET when request ' HOT 2
- 添加API
- 是否可以增加调节文字大小的功能 HOT 1
- 文章排序问题
- [error]FEED_PRIVATE_ADDRESS_ERROR HOT 1
- 历史文章丢失 HOT 1
- 提供默认预览功能 HOT 1
- 检查文章更新时间 HOT 1
- 希望能支持订阅文章的检索 HOT 1
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 rssant.