Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
neoppod
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
Levin Zimmermann
neoppod
Commits
2c03f1f6
Commit
2c03f1f6
authored
Nov 02, 2017
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
e796a2b6
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
9 additions
and
12 deletions
+9
-12
go/zodb/buffer.go
go/zodb/buffer.go
+2
-5
go/zodb/buffer_test.go
go/zodb/buffer_test.go
+3
-3
go/zodb/pydata.go
go/zodb/pydata.go
+2
-2
go/zodb/str.go
go/zodb/str.go
+2
-2
No files found.
go/zodb/buffer.go
View file @
2c03f1f6
...
...
@@ -34,7 +34,7 @@ import (
//
// Custom allocation functions affect only performance, not correctness -
// everything should work if data buffer is allocated and/or free'ed
// regular Go/GC-way.
//
via
regular Go/GC-way.
type
Buf
struct
{
Data
[]
byte
...
...
@@ -54,10 +54,9 @@ func init() {
for
i
:=
0
;
i
<
len
(
bufPoolv
);
i
++
{
i
:=
i
bufPoolv
[
i
]
.
New
=
func
()
interface
{}
{
//println("X allocating for order", i)
// NOTE *Buf, not just buf, to avoid allocation when
// making interface{} from it (interface{} wants to always point to heap)
return
&
Buf
{
Data
:
make
([]
byte
,
1
<<
(
order0
+
uint
(
i
)))}
return
&
Buf
{
Data
:
make
([]
byte
,
1
<<
(
order0
+
uint
(
i
)))}
}
}
}
...
...
@@ -116,9 +115,7 @@ func (buf *Buf) Release() {
}
// order = max i: 2^i <= cap
//order := bits.Len(uint(cap(buf.Data)))
order
:=
xmath
.
FloorLog2
(
uint64
(
cap
(
buf
.
Data
)))
//println("YYY free", cap(buf.Data), "-> order:", order)
order
-=
order0
if
order
<
0
{
...
...
go/zodb/buffer_test.go
View file @
2c03f1f6
...
...
@@ -51,9 +51,9 @@ func TestBufAllocFree(t *testing.T) {
xcap
:=
1
<<
i
buf
:=
BufAlloc
(
size
)
if
i
<
order0
{
xcap
=
1
<<
order0
xcap
=
1
<<
order0
}
if
int
(
i
)
>=
order0
+
len
(
bufPoolv
)
{
if
int
(
i
)
>=
order0
+
len
(
bufPoolv
)
{
xcap
=
size
}
...
...
@@ -80,7 +80,7 @@ func TestBufAllocFree(t *testing.T) {
buf2
:=
BufAlloc
(
size
)
// not from pool - memory won't be reused
if
int
(
i
)
>=
order0
+
len
(
bufPoolv
)
{
if
int
(
i
)
>=
order0
+
len
(
bufPoolv
)
{
if
buf2
==
buf
||
sliceDataPtr
(
buf2
.
Data
)
==
sliceDataPtr
(
data
)
{
t
.
Fatalf
(
"%v: buffer reused but should not"
,
i
)
}
...
...
go/zodb/pydata.go
View file @
2c03f1f6
go/zodb/str.go
View file @
2c03f1f6
...
...
@@ -63,10 +63,10 @@ func (xtid XTid) String() string {
}
func
(
xid
Xid
)
String
()
string
{
return
xid
.
XTid
.
String
()
+
":"
+
xid
.
Oid
.
String
()
// XXX use "·" instead of ":" ?
return
xid
.
XTid
.
String
()
+
":"
+
xid
.
Oid
.
String
()
}
/* TODO reenable
/* TODO reenable
?
func (xtid XTid) XFmtString(b []byte) []byte {
b .C("=<"[bint(xtid.TidBefore)]) .V(xtid.Tid)
}
...
...
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