-
Notifications
You must be signed in to change notification settings - Fork 136
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
Add support to configure more deprecation warnings from Dart Sass #164
Conversation
Thank you for submitting this pull request, @ntkme.
|
b8ee971
to
6187fb4
Compare
@ashmaroli I've completed you comment 1 and 2, for the Caching is a bit tricky, because for each input sass file Jekyll creates a new Converter instance. So, the cache need to be on the site level instead of converter level, because the each of these functions are only called exactly once per sass input file so there is no point to cache locally on the instance. In reality I doubt how much performance cost this will have because a site usually only have less than 10 sass entrypoint files, so it feels like a premature optimization that does not matter much. |
Thank you @ntkme. Regardless, about the Consider the following diff: - Array(sass_config.fetch("silence_deprecations", nil))
+ Array(sass_config.fetch("silence_deprecations", EMPTY_ARRAY)). Unless All that said, I won't let this small conflict block the pull request. |
6187fb4
to
1e9ab9e
Compare
That's actually not the fastest. It's a bit counter intuitive, that a const array is even slower than
Benchmark coderequire 'benchmark'
ARRAY = []
h = {
not_an_array: 'not an array',
is_an_array: ['is an array']
}
n = 10000000
def a(h, k)
Array(h[k])
end
def b(h, k)
Array(h.fetch(k, []))
end
def c(h, k)
Array(h.fetch(k, ARRAY))
end
def d(h, k)
Array(h.fetch(k, nil))
end
Benchmark.bm do |x|
# warmup
1000.times do; a(h, :test); end
1000.times do; b(h, :test); end
1000.times do; c(h, :test); end
1000.times do; d(h, :test); end
GC.start
x.report("[:not_an_array]\t\t\t") { n.times do; a(h, :not_an_array) ; end }
GC.start
x.report(".fetch(:not_an_array, [])\t") { n.times do; b(h, :not_an_array); end }
GC.start
x.report(".fetch(:not_an_array, ARRAY)\t") { n.times do; c(h, :not_an_array); end }
GC.start
x.report(".fetch(:not_an_array, nil)\t") { n.times do; d(h, :not_an_array); end }
GC.start
x.report("[:is_an_array]\t\t\t") { n.times do; a(h, :is_an_array) ; end }
GC.start
x.report(".fetch(:is_an_array, [])\t") { n.times do; b(h, :is_an_array); end }
GC.start
x.report(".fetch(:is_an_array, ARRAY)\t") { n.times do; c(h, :is_an_array); end }
GC.start
x.report(".fetch(:is_an_array, nil)\t") { n.times do; d(h, :is_an_array); end }
end |
Thanks @ntkme |
This PR adds new options for controlling deprecation messages.