HTML / JS Javascript / CSS Stylesheet minification minifier minify and compression

94 views
Skip to first unread message

c0nw...@googlemail.com

unread,
Nov 27, 2018, 11:25:40 PM11/27/18
to openresty-en
So I threw this together I hope some people will help and contribute to my regex to improve it.


I was inspired by cloudflare. Thank you @Cloudflare for the love <3 :)


Robert Paprocki

unread,
Nov 27, 2018, 11:35:11 PM11/27/18
to openre...@googlegroups.com
Nice!

A few thoughts:

- Using regular expressions for HTML parsing is always a Bad Idea :D might be better to use a saner DOM parser
- If you are going to keep using regexes, try to replace greedy quantifiers with lazy ones to reduce backtracking
- Consider using  "ngx.re.*` APIs instead of string.gsub, which cannot be JITed
- Consider using integer-based array access instead of ipairs, which might have a performance/JITability improvement


--
You received this message because you are subscribed to the Google Groups "openresty-en" group.
To unsubscribe from this group and stop receiving emails from it, send an email to openresty-en...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

C0nw0nk

unread,
Nov 27, 2018, 11:41:15 PM11/27/18
to openre...@googlegroups.com
ngx.re.gsub or sub what would you recommend i modify my line with. I am curious what one would be fastest.


You received this message because you are subscribed to a topic in the Google Groups "openresty-en" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/openresty-en/jVN5N3kE6dY/unsubscribe.
To unsubscribe from this group and all its topics, send an email to openresty-en...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages