Skip to content

Commit f3dda11

Browse files
committed
UniqueIndexTest, MmapLongIdIndexTest: take effective constant out of the loop
1 parent 0a5a124 commit f3dda11

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

dump/test/util/dump/MmapLongIdIndexTest.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -358,11 +358,12 @@ private void fillDump( Dump<Bean> dump ) throws IOException {
358358
for ( int i = 0; i < BEAN_SIZE - 15; i++ ) { // 15 is an estimation for the size of the Bean instance without this padding
359359
sb.append('0');
360360
}
361+
String padding = sb.toString();
361362

362363
/* add some elements */
363364
long t = System.currentTimeMillis();
364365
for ( int i = 0; i < _dumpSize; i++ ) {
365-
dump.add(new Bean(i, i + sb.toString()));
366+
dump.add(new Bean(i, i + padding));
366367
}
367368
System.out.println("Written " + _dumpSize + " instances to dump. Needed " + (System.currentTimeMillis() - t) / (float)_dumpSize + " ms/instance.");
368369
}

dump/test/util/dump/UniqueIndexTest.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -382,11 +382,12 @@ private void fillDump( Dump<Bean> dump ) throws IOException {
382382
for ( int i = 0; i < BEAN_SIZE - 15; i++ ) { // 15 is an estimation for the size of the Bean instance without this padding
383383
sb.append('0');
384384
}
385+
String padding = sb.toString();
385386

386387
/* add some elements */
387388
long t = System.currentTimeMillis();
388389
for ( int i = 0; i < _dumpSize; i++ ) {
389-
dump.add(new Bean(i, i + sb.toString()));
390+
dump.add(new Bean(i, i + padding));
390391
}
391392
System.out.println("Written " + _dumpSize + " instances to dump. Needed " + (System.currentTimeMillis() - t) / (float)_dumpSize + " ms/instance.");
392393
}

0 commit comments

Comments
 (0)