Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Z
zodb
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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Joshua
zodb
Commits
0fb31c06
Commit
0fb31c06
authored
Apr 05, 2011
by
Jim Fulton
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Simplified code to get a small reduction in CPU time for object loads.
parent
7a240a29
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
22 deletions
+5
-22
src/ZEO/zrpc/smac.py
src/ZEO/zrpc/smac.py
+5
-22
No files found.
src/ZEO/zrpc/smac.py
View file @
0fb31c06
...
...
@@ -279,26 +279,9 @@ class SizedMessageAsyncConnection(asyncore.dispatcher):
else
:
size
+=
self
.
__message_output
(
message
,
output
)
# Accumulate output into a single string so that we avoid
# multiple send() calls, but avoid accumulating too much
# data. If we send a very small string and have more data
# to send, we will likely incur delays caused by the
# unfortunate interaction between the Nagle algorithm and
# delayed acks. If we send a very large string, only a
# portion of it will actually be delivered at a time.
l
=
0
for
i
in
range
(
len
(
output
)):
l
+=
len
(
output
[
i
])
if
l
>
SEND_SIZE
:
break
i
+=
1
# It is very unlikely that i will be 1.
v
=
""
.
join
(
output
[:
i
])
# Note: "output" usually contains the output not yet sent
# The "del" below breaks this invariant temporarily.
# We must ensure its satisfaction again when we leave the loop
del
output
[:
i
]
v
=
""
.
join
(
output
)
del
output
[:]
try
:
n
=
self
.
send
(
v
)
...
...
@@ -310,8 +293,8 @@ class SizedMessageAsyncConnection(asyncore.dispatcher):
break
# we couldn't write anything
raise
if
n
<
l
:
output
.
insert
(
0
,
v
[
n
:])
if
n
<
l
en
(
v
)
:
output
.
append
(
v
[
n
:])
break
# we can't write any more
def
handle_close
(
self
):
...
...
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