Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Performance issue when process email containing useless big Style tag to small body content #290

Open
reinaldocoelho opened this issue Apr 20, 2022 · 1 comment
Labels
good first issue Good for newcomers performance ⚡️ Issues related to performance and benchmarks

Comments

@reinaldocoelho
Copy link
Contributor

The problem

We received some SPAM e-mails and when we will be process the content to inline CSS, the process uses a lot CPU and sometimes break down the Web Server.
When investigate to find what step of process break down, we found the problem on Inline CSS step, because the content has ~1.5 mb of style tag and only ~7kb of other contents.

Details

Premailer version: 2.4.0
Dotnet Framework: 4.8 ( we can't change to dotnet 5 :-/ )

Performance measured (dotnet Benchmark)

image

How to simulate

// Import the attached file.
var baseHtml = System.IO.File.ReadAllText("spam-big-style.html", Encoding.UTF8);
// Same process used when created the benchmark.
var resultHtml = PreMailer.Net.PreMailer.MoveCssInline(baseHtml, true, "link", null, true, true).Html;

Files

Attached one of the SPAM email received:
spam-big-style.zip

@reinaldocoelho
Copy link
Contributor Author

Maybe when Style tag are so big, we can use an different strategy to process.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers performance ⚡️ Issues related to performance and benchmarks
Projects
None yet
Development

No branches or pull requests

2 participants