Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
P
Pyston
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boxiang Sun
Pyston
Commits
5f942f2c
Commit
5f942f2c
authored
Mar 23, 2015
by
Marius Wachtler
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Slightly improve the performance of reading in cached parse result
reduces the parse time for 'import pip' from 120ms to 80ms
parent
e9fd04b4
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
6 deletions
+8
-6
src/codegen/parser.cpp
src/codegen/parser.cpp
+8
-6
No files found.
src/codegen/parser.cpp
View file @
5f942f2c
...
@@ -68,8 +68,6 @@ public:
...
@@ -68,8 +68,6 @@ public:
uint8_t
readByte
()
{
uint8_t
readByte
()
{
ensure
(
1
);
ensure
(
1
);
RELEASE_ASSERT
(
end
>
start
,
"premature eof"
);
RELEASE_ASSERT
(
end
>
start
,
"premature eof"
);
if
(
VERBOSITY
(
"parsing"
)
>=
2
)
printf
(
"readByte, now %d %d
\n
"
,
start
+
1
,
end
);
return
buf
[
start
++
];
return
buf
[
start
++
];
}
}
uint16_t
readShort
()
{
return
(
readByte
()
<<
8
)
|
(
readByte
());
}
uint16_t
readShort
()
{
return
(
readByte
()
<<
8
)
|
(
readByte
());
}
...
@@ -101,16 +99,20 @@ AST_stmt* readASTStmt(BufferedReader* reader);
...
@@ -101,16 +99,20 @@ AST_stmt* readASTStmt(BufferedReader* reader);
static
std
::
string
readString
(
BufferedReader
*
reader
)
{
static
std
::
string
readString
(
BufferedReader
*
reader
)
{
int
strlen
=
reader
->
readShort
();
int
strlen
=
reader
->
readShort
();
std
::
vector
<
char
>
chars
;
llvm
::
SmallString
<
32
>
chars
;
for
(
int
i
=
0
;
i
<
strlen
;
i
++
)
{
for
(
int
i
=
0
;
i
<
strlen
;
i
++
)
{
chars
.
push_back
(
reader
->
readByte
());
chars
.
push_back
(
reader
->
readByte
());
}
}
return
std
::
string
(
chars
.
begin
(),
chars
.
end
()
);
return
chars
.
str
().
str
(
);
}
}
InternedString
BufferedReader
::
readAndInternString
()
{
InternedString
BufferedReader
::
readAndInternString
()
{
std
::
string
str
=
readString
(
this
);
int
strlen
=
readShort
();
return
intern_pool
->
get
(
std
::
move
(
str
));
llvm
::
SmallString
<
32
>
chars
;
for
(
int
i
=
0
;
i
<
strlen
;
i
++
)
{
chars
.
push_back
(
readByte
());
}
return
intern_pool
->
get
(
chars
.
str
());
}
}
void
BufferedReader
::
readAndInternStringVector
(
std
::
vector
<
InternedString
>&
v
)
{
void
BufferedReader
::
readAndInternStringVector
(
std
::
vector
<
InternedString
>&
v
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment