简体   繁体   English

Gson在Android Studio调试器中运行缓慢

[英]Gson slow in Android Studio debugger

I find that Gson deserialization is often extremely slow (eg several seconds) when I step over it from a breakpoint in Android Studio. 我发现当我从Android Studio中的断点跨过它时,Gson反序列化通常非常慢(例如几秒钟)。 If the same code is executed while in the debugger, but not while manually stepping over it, it runs in 'normal' time (eg a few milliseconds). 如果在调试器中执行相同的代码,但在手动执行代码时不执行,则它在“正常”时间(例如几毫秒)内运行。

I haven't experienced this with any other code, and it doesn't appear to matter what I'm deserializing, or how small or large the Json is. 我没有用任何其他代码来体验这一点,并且看起来我的反序列化或Json的大小不重要。

My Gson version is 2.3.1 我的Gson版本是2.3.1

Has anyone else experienced this, or know of any way of fixing it? 有没有其他人经历过这个,或者知道有什么方法可以修复它?

转到Debug视图,单击两个红色圆圈图标(查看并管理所有断点和观察点),删除所有断点,再次运行应用程序,然后重新添加所需的断点。

Its quite normal. 这很正常。 I face it all the time with Gson usually instead of Step Over (F8 on OSX) if you put two break point just before and after deserialization LOC and use Resume Program (Option + Cmd + R on OSX) instead it works fine. 如果你在反序列化LOC之前和之后放置两个断点并使用Resume Program (OSX上的Option + Cmd + R),我通常会一直面对Gson而不是Step Over (OSX上的F8),而是工作正常。

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

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