Skip to content

Commit b38d026

Browse files
committed
Remove fastutil dependency
1 parent 4e70506 commit b38d026

File tree

14 files changed

+34
-53
lines changed

14 files changed

+34
-53
lines changed

ulyp-agent-core/build.gradle

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ dependencies {
2121
annotationProcessor group: 'org.projectlombok', name: 'lombok', version: '1.18.24'
2222
compileOnly group: 'com.google.code.findbugs', name: 'jsr305', version: '3.0.2'
2323

24-
testImplementation group: 'it.unimi.dsi', name: 'fastutil', version: '8.5.12'
2524
testImplementation group: 'net.bytebuddy', name: 'byte-buddy', version: '1.15.11'
2625
testImplementation group: 'org.hamcrest', name: 'hamcrest', version: '2.2'
2726
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.11.3'

ulyp-agent-tests/build.gradle

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ dependencies {
2323
implementation project(':ulyp-agent-core')
2424
implementation project(':ulyp-storage')
2525

26-
implementation group: 'it.unimi.dsi', name: 'fastutil', version: '8.5.12'
2726
implementation group: 'org.jetbrains', name: 'annotations', version: '18.0.0'
2827
implementation group: 'org.hamcrest', name: 'hamcrest', version: '2.2'
2928
implementation group: 'org.slf4j', name: 'slf4j-api', version: '1.7.2'

ulyp-benchmarks/build.gradle

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ dependencies {
2727
jmhImplementation group: 'javax.annotation', name: 'javax.annotation-api', version: '1.3.2'
2828
jmhImplementation group: 'org.jetbrains', name: 'annotations', version: '18.0.0'
2929
jmhImplementation group: 'org.rocksdb', name: 'rocksdbjni', version: '9.7.3'
30-
jmhImplementation group: 'it.unimi.dsi', name: 'fastutil', version: '8.5.12'
3130

3231
jmhImplementation group: 'com.hazelcast', name: 'hazelcast', version: '5.5.0'
3332
jmhImplementation group: 'org.glassfish.jaxb', name: 'jaxb-runtime', version: '2.3.2'

ulyp-common/build.gradle

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,10 @@ sourceCompatibility = 1.8
2020
dependencies {
2121
compileOnly group: 'javax.annotation', name: 'javax.annotation-api', version: '1.3.2'
2222
compileOnly group: 'com.google.code.findbugs', name: 'jsr305', version: '3.0.2'
23-
compileOnly group: 'it.unimi.dsi', name: 'fastutil', version: '8.5.12'
2423
compileOnly group: 'org.agrona', name: 'agrona', version: '1.4.0'
2524
compileOnly group: 'org.jetbrains', name: 'annotations', version: '18.0.0'
2625
compileOnly group: 'org.slf4j', name: 'slf4j-api', version: '1.7.2'
2726

28-
testImplementation group: 'it.unimi.dsi', name: 'fastutil', version: '8.5.12'
2927
testImplementation group: 'org.agrona', name: 'agrona', version: '1.4.0'
3028
testImplementation group: 'org.slf4j', name: 'slf4j-api', version: '1.7.2'
3129

ulyp-common/src/main/java/com/ulyp/core/util/BitUtil.java

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package com.ulyp.core.util;
22

3-
import it.unimi.dsi.fastutil.longs.LongArrayList;
4-
import it.unimi.dsi.fastutil.longs.LongList;
3+
import org.agrona.collections.LongArrayList;
54

65
public class BitUtil {
76

@@ -26,7 +25,7 @@ public static void longToBytes(long value, byte[] dst, int offset) {
2625
}
2726
}
2827

29-
public static byte[] longsToBytes(LongList list) {
28+
public static byte[] longsToBytes(LongArrayList list) {
3029
byte[] result = new byte[Long.BYTES * list.size()];
3130
for (int i = 0; i < list.size(); i++) {
3231
longToBytes(list.getLong(i), result, i * Long.BYTES);
@@ -53,9 +52,9 @@ public static int bytesToInt(final byte[] bytes, int offset) {
5352
}
5453

5554

56-
public static LongList bytesToLongs(final byte[] bytes) {
55+
public static LongArrayList bytesToLongs(final byte[] bytes) {
5756
int size = bytes.length / Long.BYTES;
58-
LongList result = new LongArrayList(size);
57+
LongArrayList result = new LongArrayList(size, Long.MIN_VALUE);
5958
for (int i = 0; i < size; i++) {
6059
result.add(BitUtil.bytesToLong(bytes, i * Long.BYTES));
6160
}

ulyp-storage/build.gradle

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,13 @@ dependencies {
2121
implementation project(':ulyp-common')
2222

2323
compileOnly group: 'javax.annotation', name: 'javax.annotation-api', version: '1.3.2'
24-
compileOnly group: 'it.unimi.dsi', name: 'fastutil', version: '8.5.12'
2524

2625
implementation group: 'org.agrona', name: 'agrona', version: '1.4.0'
2726
implementation group: 'org.jetbrains', name: 'annotations', version: '18.0.0'
2827
implementation group: 'org.slf4j', name: 'slf4j-api', version: '1.7.2'
2928

3029
compileOnly group: 'org.rocksdb', name: 'rocksdbjni', version: '9.7.3'
3130
testImplementation group: 'org.rocksdb', name: 'rocksdbjni', version: '9.7.3'
32-
testImplementation group: 'it.unimi.dsi', name: 'fastutil', version: '8.5.12'
3331

3432
implementation group: 'org.jetbrains', name: 'annotations', version: '18.0.0'
3533
testImplementation group: 'org.awaitility', name: 'awaitility', version: '4.1.1'

ulyp-storage/src/main/java/com/ulyp/storage/tree/BinaryRecordedCallStateSerializer.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@
33
import com.ulyp.core.bytes.BytesIn;
44
import com.ulyp.core.bytes.BytesOut;
55
import com.ulyp.core.serializers.Serializer;
6-
import it.unimi.dsi.fastutil.longs.LongArrayList;
7-
import it.unimi.dsi.fastutil.longs.LongList;
6+
import org.agrona.collections.LongArrayList;
87

98
public class BinaryRecordedCallStateSerializer implements Serializer<CallRecordIndexState> {
109

@@ -17,7 +16,7 @@ public CallRecordIndexState deserialize(BytesIn input) {
1716
int subtreeSize = input.readInt();
1817
long exitCallRecordAddress = input.readLong();
1918
int childrenCallCount = input.readInt();
20-
LongList childrenCallIds = new LongArrayList(childrenCallCount);
19+
LongArrayList childrenCallIds = new LongArrayList(childrenCallCount, Long.MIN_VALUE);
2120
for (int i = 0; i < childrenCallCount; i++) {
2221
childrenCallIds.add(input.readLong());
2322
}
@@ -36,7 +35,7 @@ public void serialize(BytesOut out, CallRecordIndexState value) {
3635
out.write(value.getEnterMethodCallAddress());
3736
out.write(value.getSubtreeSize());
3837
out.write(value.getExitMethodCallAddr());
39-
LongList childrenCallIds = value.getChildrenCallIds();
38+
LongArrayList childrenCallIds = value.getChildrenCallIds();
4039
int childrenCallIdCount = childrenCallIds.size();
4140
out.write(childrenCallIdCount);
4241
for (int i = 0; i < childrenCallIdCount; i++) {

ulyp-storage/src/main/java/com/ulyp/storage/tree/CallRecord.java

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44
import com.ulyp.core.recorders.NotRecordedObjectRecord;
55
import com.ulyp.core.recorders.ObjectRecord;
66
import com.ulyp.storage.StorageException;
7-
import it.unimi.dsi.fastutil.longs.LongList;
87
import lombok.Builder;
98
import lombok.Getter;
9+
import org.agrona.collections.LongArrayList;
1010
import org.jetbrains.annotations.NotNull;
1111

1212
import java.util.List;
@@ -42,9 +42,12 @@ public class CallRecord {
4242
private final int subtreeSize;
4343
@Getter
4444
private final long nanosDuration;
45+
@Getter
4546
private final Method method;
47+
@Getter
4648
private final List<ObjectRecord> args;
47-
private final LongList childrenCallIds;
49+
@Getter
50+
private final LongArrayList childrenCallIds;
4851
private final RecordingState recordingState;
4952
@Builder.Default
5053
private final ObjectRecord callee = NotRecordedObjectRecord.getInstance();
@@ -68,14 +71,6 @@ public long getId() {
6871
return callId;
6972
}
7073

71-
public LongList getChildrenCallIds() {
72-
return childrenCallIds;
73-
}
74-
75-
public List<ObjectRecord> getArgs() {
76-
return args;
77-
}
78-
7974
@NotNull
8075
public ObjectRecord getReturnValue() {
8176
return returnValue;
@@ -85,10 +80,6 @@ public boolean hasThrown() {
8580
return thrown;
8681
}
8782

88-
public Method getMethod() {
89-
return method;
90-
}
91-
9283
public List<CallRecord> getChildren() throws StorageException {
9384
if (children != null) {
9485
return children;
Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
package com.ulyp.storage.tree;
22

3-
import it.unimi.dsi.fastutil.longs.LongArrayList;
4-
import it.unimi.dsi.fastutil.longs.LongList;
53
import lombok.*;
4+
import org.agrona.collections.LongArrayList;
65

76
@Getter
87
@Builder
@@ -15,10 +14,11 @@ public class CallRecordIndexState {
1514
private final long id;
1615
private final long enterMethodCallAddress;
1716
@Builder.Default
18-
private final LongList childrenCallIds = new LongArrayList();
17+
private final LongArrayList childrenCallIds = new LongArrayList();
1918
@Builder.Default
2019
private int subtreeSize = 1;
2120
@Builder.Default
21+
@Setter
2222
private long exitMethodCallAddr = -1;
2323

2424
public void incrementSubtreeSize() {
@@ -28,8 +28,4 @@ public void incrementSubtreeSize() {
2828
public void addChildrenCallId(long callId) {
2929
childrenCallIds.add(callId);
3030
}
31-
32-
public void setExitMethodCallAddr(long value) {
33-
this.exitMethodCallAddr = value;
34-
}
3531
}

ulyp-storage/src/main/java/com/ulyp/storage/tree/MemCallStack.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
package com.ulyp.storage.tree;
22

3-
import it.unimi.dsi.fastutil.longs.Long2ObjectMap;
4-
import it.unimi.dsi.fastutil.longs.Long2ObjectOpenHashMap;
53
import org.jetbrains.annotations.Nullable;
64

75
import java.util.ArrayDeque;
86
import java.util.Deque;
7+
import java.util.HashMap;
8+
import java.util.Map;
99

1010
/**
1111
* Maintains a call stack for each recording being processed. Having in-memory stack
@@ -16,7 +16,9 @@
1616
public class MemCallStack {
1717

1818
private final Deque<CallRecordIndexState> deque = new ArrayDeque<>();
19-
private final Long2ObjectMap<CallRecordIndexState> lookupIndex = new Long2ObjectOpenHashMap<>();
19+
20+
// We don't optimize boxing, it's used in UI app
21+
private final Map<Long, CallRecordIndexState> lookupIndex = new HashMap<>();
2022

2123
public CallRecordIndexState get(long callId) {
2224
return lookupIndex.get(callId);

0 commit comments

Comments
 (0)