-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
BREAKING-CHANGES: insertLong(), insertString() etc, moved into public inner class + ColumnType enum renamed #97
Changes from 10 commits
758d78e
42b5075
61aeb1b
162b681
084a71a
0cd398d
f8936fb
1652eb6
a671538
80d0443
ad1466d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package com.tightdb.examples.quickbenchmark; | ||
|
||
import java.util.Date; | ||
|
||
import com.tightdb.ColumnType; | ||
import com.tightdb.Table; | ||
|
||
public class InsertPerformance { | ||
|
||
public static void main(String[] args) { | ||
|
||
Table t = new Table(); | ||
|
||
|
||
t.addColumn(ColumnType.STRING, "String"); | ||
t.addColumn(ColumnType.BOOLEAN, "Bool"); | ||
t.addColumn(ColumnType.LONG, "Long"); | ||
t.addColumn(ColumnType.DATE, "Date"); | ||
|
||
Long timer = System.currentTimeMillis(); | ||
|
||
System.out.println("Performance test for inserting values in table:"); | ||
|
||
for (int i=0;i<50000000;i++){ | ||
|
||
t.add("String", false, 4000L, new Date()); | ||
|
||
if (i % 1000000 == 0 && i > 0){ | ||
System.out.println(i + " split time: " + (System.currentTimeMillis() - timer)); | ||
} | ||
} | ||
|
||
System.out.println("Total time in miliseconds: " + (System.currentTimeMillis() - timer)); | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,15 +6,15 @@ | |
// FIXME: Add a unit test that verifies the correct correspondance. | ||
|
||
public enum ColumnType { | ||
ColumnTypeBool(1), | ||
ColumnTypeInt(0), | ||
ColumnTypeFloat(9), | ||
ColumnTypeDouble(10), | ||
ColumnTypeString(2), | ||
ColumnTypeBinary(4), | ||
ColumnTypeDate(7), | ||
ColumnTypeTable(5), | ||
ColumnTypeMixed(6); | ||
BOOLEAN(1), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We should consider to make the Enums with only first letter Uppercase, and the rest lowercase. That way, it's the same as you write in the typed interface. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The thing is, Enums are constants in java. The convention is to use upper case. See: It's correct that it differs from the typed interface differs anyway. But the typed interface is a different animal and also supports simple types e.g. int and long instead of Integer and Long. |
||
LONG(0), | ||
FLOAT(9), | ||
DOUBLE(10), | ||
STRING(2), | ||
BINARY(4), | ||
DATE(7), | ||
TABLE(5), | ||
MIXED(6); | ||
// When adding above, remember to update size of largest number below | ||
|
||
private final int nativeValue; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suggest we move this to /experiment folder, since all under examples are distributed to customers.
It would also be good here to test the difference between add() and the local insert() methods.