BoD/android-contentprovider-generator

Unnecessary autoboxing in AbstractCursor and generated cursors

Closed this issue · 4 comments

I think it isn't very efficient:

public Integer getIntegerOrNull(String colName) {
        Integer index = getCachedColumnIndexOrThrow(colName); // int to Integer
        if (isNull(index)) return null; // Integer to int
        return getInt(index); // Integer to int and int to Integer
}

and

public class GeneratedCursor extends AbstractCursor {
        ...
        public String getTitle() {
                Integer index = getCachedColumnIndexOrThrow(GeneratedColumns.TITLE); // int to Integer
                return getString(index); // Integer to int
        }
        ...
}

Is there any progress for this issue? Problem is sufficiently important, Google recommend to avoid unnecessary autoboxing due performance issues and I think it may be easily fixed.

BoD commented

Hi! I don't believe a performance issue really exists until measurements are there to show its existence.
But if you really think this needs to be "fixed", please don't hesitate to submit a pull request :-)

OK, I'll try to do it on the weekend.

BoD commented

I think this has been fixed now.