Skip to content
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

maybe unnecessary call of convertParsedMapsToJava inside JsonReader.readObject() #18

Open
GoogleCodeExporter opened this issue Nov 21, 2015 · 0 comments

Comments

@GoogleCodeExporter
Copy link

What version of the product are you using? On what operating system?
2.6.1, Suse Linux

Please provide any additional information below.

if I don't want to have the java object, but only the map representation of the 
json (by giving the constructor 'true' for noObjects), convertParsedMapsToJava 
is still invoked - is this necessary or simply an unnecessary overhead in this 
case? This is the readObject() code from JsonReader:

    public Object readObject() throws IOException
    {
        Object o = readJsonObject();
        if (o == EMPTY_OBJECT)
        {
            return new JsonObject();
        }

        Object graph = convertParsedMapsToJava((JsonObject) o);

        // Allow a complete 'Map' return (Javascript style)
        if (_noObjects)
        {
            return o;
        }
        return graph;
    }

Maybe it could be more efficient if convertParsedMapsToJava is only invoked if 
necessary:

    public Object readObject() throws IOException
    {
        Object o = readJsonObject();
        if (o == EMPTY_OBJECT)
        {
            return new JsonObject();
        }

        // Allow a complete 'Map' return (Javascript style)
        if (_noObjects)
        {
            return o;
        }

        Object graph = convertParsedMapsToJava((JsonObject) o);

        return graph;
    }


Original issue reported on code.google.com by [email protected] on 8 Jul 2014 at 1:04

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant