Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
lwm1986
roslyn
提交
81688b65
R
roslyn
项目概览
lwm1986
/
roslyn
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
roslyn
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
81688b65
编写于
2月 26, 2016
作者:
V
VSadov
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #8839 from VSadov/perfFixes
Reduce allocations in deterministic builds.
上级
ddaf4146
2c16015e
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
38 addition
and
31 deletion
+38
-31
src/Compilers/Core/Portable/NativePdbWriter/PdbWriter.cs
src/Compilers/Core/Portable/NativePdbWriter/PdbWriter.cs
+38
-30
src/Compilers/Core/Portable/StrongName/StrongNameKeys.cs
src/Compilers/Core/Portable/StrongName/StrongNameKeys.cs
+0
-1
未找到文件。
src/Compilers/Core/Portable/NativePdbWriter/PdbWriter.cs
浏览文件 @
81688b65
...
...
@@ -48,7 +48,7 @@ internal sealed class PdbLogger
// On the other hand, we do want to use a fairly large buffer as the hashing operations
// are invoked through reflection, which is fairly slow.
private
readonly
bool
_logging
;
private
readonly
Pooled
BlobBuilder
_logData
;
private
readonly
BlobBuilder
_logData
;
private
const
int
bufferFlushLimit
=
64
*
1024
;
private
readonly
HashAlgorithm
_hashAlgorithm
;
...
...
@@ -57,7 +57,11 @@ internal PdbLogger(bool logging)
_logging
=
logging
;
if
(
logging
)
{
_logData
=
PooledBlobBuilder
.
GetInstance
();
// do not get this from pool
// we need a fairly large buffer here (where the pool typically contains small ones)
// and we need just one per compile session
// pooling will be couter-productive in such scenario
_logData
=
new
BlobBuilder
(
bufferFlushLimit
);
_hashAlgorithm
=
new
SHA1CryptoServiceProvider
();
Debug
.
Assert
(
_hashAlgorithm
.
SupportsTransform
);
}
...
...
@@ -68,9 +72,11 @@ internal PdbLogger(bool logging)
}
}
private
void
MaybeFlush
(
)
private
void
EnsureSpace
(
int
space
)
{
if
(
_logData
.
Count
>=
bufferFlushLimit
)
// note that if space > bufferFlushLimit, the buffer will need to expand anyways
// that should be very rare though.
if
(
_logData
.
Count
+
space
>=
bufferFlushLimit
)
{
foreach
(
var
blob
in
_logData
.
GetBlobs
())
{
...
...
@@ -110,7 +116,6 @@ internal byte[] GetLogHash()
internal
void
Close
()
{
_hashAlgorithm
?.
Dispose
();
_logData
?.
Free
();
}
internal
enum
PdbWriterOperation
:
byte
...
...
@@ -146,56 +151,57 @@ public bool LogOperation(PdbWriterOperation op)
return
logging
;
}
public
void
LogArgument
(
uint
[]
data
)
public
void
LogArgument
(
uint
[]
data
,
int
cnt
)
{
_logData
.
WriteInt32
(
data
.
Length
);
for
(
int
i
=
0
;
i
<
data
.
Length
;
i
++)
EnsureSpace
((
cnt
+
1
)
*
4
);
_logData
.
WriteInt32
(
cnt
);
for
(
int
i
=
0
;
i
<
cnt
;
i
++)
{
_logData
.
WriteUInt32
(
data
[
i
]);
}
MaybeFlush
();
}
public
void
LogArgument
(
string
data
)
{
EnsureSpace
(
data
.
Length
*
2
);
_logData
.
WriteUTF8
(
data
,
allowUnpairedSurrogates
:
true
);
MaybeFlush
();
}
public
void
LogArgument
(
uint
data
)
{
EnsureSpace
(
4
);
_logData
.
WriteUInt32
(
data
);
}
public
void
LogArgument
(
byte
data
)
{
EnsureSpace
(
1
);
_logData
.
WriteByte
(
data
);
}
public
void
LogArgument
(
byte
[]
data
)
{
LogArgument
(
data
.
Length
);
EnsureSpace
(
data
.
Length
+
4
);
_logData
.
WriteInt32
(
data
.
Length
);
_logData
.
WriteBytes
(
data
);
MaybeFlush
();
}
public
void
LogArgument
(
int
[]
data
)
{
LogArgument
(
data
.
Length
);
foreach
(
int
d
in
data
)
LogArgument
(
d
);
MaybeFlush
();
EnsureSpace
((
data
.
Length
+
1
)
*
4
);
_logData
.
WriteInt32
(
data
.
Length
);
foreach
(
int
d
in
data
)
{
_logData
.
WriteInt32
(
d
);
}
}
public
void
LogArgument
(
long
data
)
{
EnsureSpace
(
8
);
_logData
.
WriteInt64
(
data
);
}
public
void
LogArgument
(
int
data
)
{
_logData
.
WriteInt32
(
data
);
}
public
void
LogArgument
(
object
data
)
{
string
str
;
...
...
@@ -213,10 +219,12 @@ public void LogArgument(object data)
}
else
{
// being conservative here
// string and decimal are handled above,
// everything else is 8 bytes or less.
EnsureSpace
(
8
);
_logData
.
WriteConstant
(
data
);
}
MaybeFlush
();
}
}
...
...
@@ -1153,11 +1161,11 @@ private void WriteSequencePoints(ISymUnmanagedDocumentWriter symDocument, int co
if
(
_callLogger
.
LogOperation
(
OP
.
DefineSequencePoints
))
{
_callLogger
.
LogArgument
((
uint
)
count
);
_callLogger
.
LogArgument
(
_sequencePointOffsets
);
_callLogger
.
LogArgument
(
_sequencePointStartLines
);
_callLogger
.
LogArgument
(
_sequencePointStartColumns
);
_callLogger
.
LogArgument
(
_sequencePointEndLines
);
_callLogger
.
LogArgument
(
_sequencePointEndColumns
);
_callLogger
.
LogArgument
(
_sequencePointOffsets
,
count
);
_callLogger
.
LogArgument
(
_sequencePointStartLines
,
count
);
_callLogger
.
LogArgument
(
_sequencePointStartColumns
,
count
);
_callLogger
.
LogArgument
(
_sequencePointEndLines
,
count
);
_callLogger
.
LogArgument
(
_sequencePointEndColumns
,
count
);
}
}
catch
(
Exception
ex
)
...
...
@@ -1345,9 +1353,9 @@ private void DefineLocalVariable(uint index, string name, uint attributes, uint
if
(
_callLogger
.
LogOperation
(
OP
.
DefineAsyncStepInfo
))
{
_callLogger
.
LogArgument
((
uint
)
count
);
_callLogger
.
LogArgument
(
yields
);
_callLogger
.
LogArgument
(
resumes
);
_callLogger
.
LogArgument
(
methods
);
_callLogger
.
LogArgument
(
yields
,
count
);
_callLogger
.
LogArgument
(
resumes
,
count
);
_callLogger
.
LogArgument
(
methods
,
count
);
}
}
catch
(
Exception
ex
)
...
...
src/Compilers/Core/Portable/StrongName/StrongNameKeys.cs
浏览文件 @
81688b65
...
...
@@ -95,7 +95,6 @@ internal static StrongNameKeys Create(string keyFilePath, CommonMessageProvider
try
{
Debug
.
Assert
(
PathUtilities
.
IsAbsolute
(
keyFilePath
));
var
fileContent
=
ImmutableArray
.
Create
(
PortableShim
.
File
.
ReadAllBytes
(
keyFilePath
));
return
CreateHelper
(
fileContent
,
keyFilePath
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录