Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Forever310
druid
提交
7a351dfd
D
druid
项目概览
Forever310
/
druid
与 Fork 源项目一致
从无法访问的项目Fork
通知
3
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
druid
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
7a351dfd
编写于
5月 19, 2014
作者:
X
Xavier Léauté
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
optimize lookups by caching bytebuffer copy
上级
be92c322
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
31 addition
and
15 deletion
+31
-15
processing/src/main/java/io/druid/query/aggregation/hyperloglog/HyperUniquesSerde.java
...ruid/query/aggregation/hyperloglog/HyperUniquesSerde.java
+3
-2
processing/src/main/java/io/druid/segment/data/ConciseCompressedIndexedInts.java
...a/io/druid/segment/data/ConciseCompressedIndexedInts.java
+3
-2
processing/src/main/java/io/druid/segment/data/GenericIndexed.java
...g/src/main/java/io/druid/segment/data/GenericIndexed.java
+18
-7
processing/src/main/java/io/druid/segment/data/IndexedRTree.java
...ing/src/main/java/io/druid/segment/data/IndexedRTree.java
+4
-2
processing/src/main/java/io/druid/segment/data/IntBufferIndexedInts.java
...main/java/io/druid/segment/data/IntBufferIndexedInts.java
+3
-2
未找到文件。
processing/src/main/java/io/druid/query/aggregation/hyperloglog/HyperUniquesSerde.java
浏览文件 @
7a351dfd
...
...
@@ -128,8 +128,9 @@ public class HyperUniquesSerde extends ComplexMetricSerde
@Override
public
HyperLogLogCollector
fromByteBuffer
(
ByteBuffer
buffer
,
int
numBytes
)
{
buffer
.
limit
(
buffer
.
position
()
+
numBytes
);
return
HyperLogLogCollector
.
makeCollector
(
buffer
);
final
ByteBuffer
readOnlyBuffer
=
buffer
.
asReadOnlyBuffer
();
readOnlyBuffer
.
limit
(
readOnlyBuffer
.
position
()
+
numBytes
);
return
HyperLogLogCollector
.
makeCollector
(
readOnlyBuffer
);
}
@Override
...
...
processing/src/main/java/io/druid/segment/data/ConciseCompressedIndexedInts.java
浏览文件 @
7a351dfd
...
...
@@ -123,8 +123,9 @@ public class ConciseCompressedIndexedInts implements IndexedInts, Comparable<Con
@Override
public
ImmutableConciseSet
fromByteBuffer
(
ByteBuffer
buffer
,
int
numBytes
)
{
buffer
.
limit
(
buffer
.
position
()
+
numBytes
);
return
new
ImmutableConciseSet
(
buffer
.
asReadOnlyBuffer
());
final
ByteBuffer
readOnlyBuffer
=
buffer
.
asReadOnlyBuffer
();
readOnlyBuffer
.
limit
(
readOnlyBuffer
.
position
()
+
numBytes
);
return
new
ImmutableConciseSet
(
readOnlyBuffer
);
}
@Override
...
...
processing/src/main/java/io/druid/segment/data/GenericIndexed.java
浏览文件 @
7a351dfd
...
...
@@ -154,6 +154,7 @@ public class GenericIndexed<T> implements Indexed<T>
private
final
int
size
;
private
final
boolean
cacheable
;
private
final
ThreadLocal
<
ByteBuffer
>
cachedBuffer
;
private
final
ThreadLocal
<
SizedLRUMap
<
Integer
,
T
>>
cachedValues
=
new
ThreadLocal
<
SizedLRUMap
<
Integer
,
T
>>()
{
@Override
protected
SizedLRUMap
<
Integer
,
T
>
initialValue
()
...
...
@@ -178,6 +179,15 @@ public class GenericIndexed<T> implements Indexed<T>
indexOffset
=
theBuffer
.
position
();
valuesOffset
=
theBuffer
.
position
()
+
(
size
<<
2
);
this
.
cachedBuffer
=
new
ThreadLocal
<
ByteBuffer
>()
{
@Override
protected
ByteBuffer
initialValue
()
{
return
theBuffer
.
asReadOnlyBuffer
();
}
};
this
.
cacheable
=
strategy
instanceof
CacheableObjectStrategy
;
}
...
...
@@ -210,23 +220,24 @@ public class GenericIndexed<T> implements Indexed<T>
}
}
final
ByteBuffer
copyBuffer
=
this
.
cachedBuffer
.
get
();
final
int
startOffset
;
final
int
endOffset
;
if
(
index
==
0
)
{
startOffset
=
4
;
endOffset
=
the
Buffer
.
getInt
(
indexOffset
);
endOffset
=
copy
Buffer
.
getInt
(
indexOffset
);
}
else
{
final
int
position
=
indexOffset
+
((
index
-
1
)
*
4
);
startOffset
=
theBuffer
.
getInt
(
position
)
+
4
;
endOffset
=
theBuffer
.
getInt
(
position
+
Ints
.
BYTES
);
copyBuffer
.
position
(
indexOffset
+
((
index
-
1
)
*
4
)
);
startOffset
=
copyBuffer
.
getInt
(
)
+
4
;
endOffset
=
copyBuffer
.
getInt
(
);
}
if
(
startOffset
==
endOffset
)
{
return
null
;
}
final
ByteBuffer
copyBuffer
=
this
.
theBuffer
.
asReadOnlyBuffer
();
copyBuffer
.
position
(
valuesOffset
+
startOffset
);
final
int
size
=
endOffset
-
startOffset
;
final
T
value
=
strategy
.
fromByteBuffer
(
copyBuffer
,
size
);
...
...
@@ -310,9 +321,9 @@ public class GenericIndexed<T> implements Indexed<T>
}
@Override
public
String
fromByteBuffer
(
ByteBuffer
buffer
,
int
numBytes
)
public
String
fromByteBuffer
(
final
ByteBuffer
buffer
,
final
int
numBytes
)
{
byte
[]
bytes
=
new
byte
[
numBytes
];
final
byte
[]
bytes
=
new
byte
[
numBytes
];
buffer
.
get
(
bytes
);
return
new
String
(
bytes
,
Charsets
.
UTF_8
);
}
...
...
processing/src/main/java/io/druid/segment/data/IndexedRTree.java
浏览文件 @
7a351dfd
...
...
@@ -81,8 +81,10 @@ public class IndexedRTree implements Comparable<IndexedRTree>
@Override
public
ImmutableRTree
fromByteBuffer
(
ByteBuffer
buffer
,
int
numBytes
)
{
buffer
.
limit
(
buffer
.
position
()
+
numBytes
);
return
new
ImmutableRTree
(
buffer
.
asReadOnlyBuffer
());
final
ByteBuffer
readOnlyBuffer
=
buffer
.
asReadOnlyBuffer
();
readOnlyBuffer
.
limit
(
readOnlyBuffer
.
position
()
+
numBytes
);
return
new
ImmutableRTree
(
readOnlyBuffer
);
}
@Override
...
...
processing/src/main/java/io/druid/segment/data/IntBufferIndexedInts.java
浏览文件 @
7a351dfd
...
...
@@ -101,8 +101,9 @@ public class IntBufferIndexedInts implements IndexedInts, Comparable<IntBufferIn
@Override
public
IntBufferIndexedInts
fromByteBuffer
(
ByteBuffer
buffer
,
int
numBytes
)
{
buffer
.
limit
(
buffer
.
position
()
+
numBytes
);
return
new
IntBufferIndexedInts
(
buffer
);
final
ByteBuffer
readOnlyBuffer
=
buffer
.
asReadOnlyBuffer
();
readOnlyBuffer
.
limit
(
readOnlyBuffer
.
position
()
+
numBytes
);
return
new
IntBufferIndexedInts
(
readOnlyBuffer
);
}
@Override
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录