使用“BufferedImage”是真的吗?将获得在检票口加载图像的性能?
为了诊断 wicket 中使用“bufferedDynamicImageResource”和“静态图像资源路径”加载图像的最佳性能方式,我尝试了以下示例:
使用“BufferedImage”
BufferedImage _img = ImageIO.read(file);
BufferedDynamicImageResource bufferedDynamicImage = new BufferedDynamicImageResource();
bufferedDynamicImage.setImage(_img);
Image image1 = new Image("img_1", bufferedDynamicImage);
使用静态资源路径
Image image2=new Image("img_2","5683466325_5431b65113_z.jpg");
使用“静态资源”加载图像的响应时间约为 299ms,而使用“BufferedImage” ” 首次加载仅 58 毫秒。我已经在本地测试了它并在 Tomcat 上部署了我的。那么除了JVM内存考虑问题之外,如果图像请求资源足够小,我们是否可以更好地从内存获取图像而不是从本地磁盘加载图像?
问候
万斯
As to diagnose the best performant way in wicket for loading images by using "bufferedDynamicImageResource" and "static image resource path", I've tried the following sample:
using "BufferedImage"
BufferedImage _img = ImageIO.read(file);
BufferedDynamicImageResource bufferedDynamicImage = new BufferedDynamicImageResource();
bufferedDynamicImage.setImage(_img);
Image image1 = new Image("img_1", bufferedDynamicImage);
using static resource path
Image image2=new Image("img_2","5683466325_5431b65113_z.jpg");
The response time for loading images using "static resource" is about 299ms while using "BufferedImage" is only 58ms in the first load. I've tested it on local and deploy my on Tomcat. SO besides the JVM memory consideration problems, do we better getting images from memory instead of loading them from local disk if the images request resource is small enough?
Regards
Vance
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论