Closed GoogleCodeExporter closed 8 years ago
can you please provide more info, such as sample of table structure and example
of API usage?
Original comment by i...@polevoy.org
on 29 Aug 2012 at 8:32
this is written quickly in abstract language:
create table user (
name text.
surname text,
middlename text
dob date,
haircolor text
)
for (i = 0 to 200 000) {
insert into user values ('jacob', null, null, null, null);
}
List<usermodel> um = usermodel.findall();
for(usermodel user : um) {
if (user.get("name") != null)
some-other-object.setName(user.get("name"));
if (user.get("surname") != null)
some-other-object.setSurName(user.get("surname"));
if (user.get("middlename") != null)
some-other-object.setMiddleName(user.get("middlename"));
if (user.get("dob") != null)
some-other-object.setdob(user.get("dob"));
if (user.get("haircolor") != null)
some-other-object.setHair(user.get("haircolor"));
}
The last four if's will result in huge comparisons because the values are
nulls. Take a look at Model.java line 1022. There you will see that user.get
will ultimately result in trying to pluralize or some other magic to find the
answer which results in very very slow performance.
Original comment by mar...@unitedtickets.ee
on 29 Aug 2012 at 8:50
Can this be made optional?
Like setting some static boolean variable, or passing one along with get? Or
perhaps creating an additional get method which simply only tries to get from
hash table and returns null if nothing is found like it is done for column "id"
now.
Original comment by ma...@unitedtickets.ee
on 1 Sep 2012 at 11:31
exactly, I was thinking along the same lines. I will create an optional system
property that will turn it off. This way, all existing projects that
potentially depend on this logic will not brake.
Original comment by i...@polevoy.org
on 1 Sep 2012 at 2:06
this has been fixed and pushed to the snapshot repo, please see:
http://ipsolutionsdev.com/activejdbc/org/javalite/activejdbc/Model.html#get(java
.lang.String)
for a new system property.
The new snapshot 1.4.4-SNAPSHOT has been pushed to the snapshot repo:
https://oss.sonatype.org/content/repositories/snapshots/org/javalite/
Please, try it out, if works for you, I will make a new release.
thanks,
igor
Original comment by ipolevoy@gmail.com
on 1 Sep 2012 at 9:23
Yes it works,
thank you Igor
Original comment by mar...@unitedtickets.ee
on 2 Sep 2012 at 4:21
all right, I will make a new release then
Original comment by i...@polevoy.org
on 2 Sep 2012 at 4:54
new release 1.4.4 is out, will be sync-ed to Maven central in a few hours
Original comment by ipolevoy@gmail.com
on 2 Sep 2012 at 5:50
Original issue reported on code.google.com by
mar...@unitedtickets.ee
on 29 Aug 2012 at 8:23