简体   繁体   English

如果我们需要/在 rails 应用程序中包含任何 gem 并且只使用它的 2%,是否有任何问题(性能或其他)

[英]Are there any issues(performance or others) if we require/include any gem in rails app and just use its 2%

For instance, rmagick, we use it just for making thumbnails which, say we only make use of 2% of that gem/lib.例如,rmagick,我们只使用它来制作缩略图,也就是说我们只使用了 2% 的 gem/lib。

Will it make sense not to use rmagick just for the purpose of making thumbnails and call image-magic apis from sh script, and hence not to have too many gems specified in Gemfile, less dependency etc?不使用 rmagick 只是为了制作缩略图并从 sh 脚本调用 image-magic api 是否有意义,因此在 Gemfile 中没有指定太多的 gem,减少依赖等?

Want to know experts opinions.想知道专家意见。

The main disadvantage is more memory use (especially in this case because rmagick has a reputation for memory leaking).主要缺点是更多的 memory 使用(特别是在这种情况下,因为 rmagick 以 memory 泄漏而闻名)。 I suggest the mini_magick gem as a smaller replacement.我建议将 mini_magick gem 作为较小的替代品。

There's also the possibility that a badly written gem might break something else in your app.还有一种可能是,一个写得不好的 gem 可能会破坏你应用程序中的其他东西。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM