Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
f94127f2
Commit
f94127f2
authored
May 15, 2007
by
Markus Amsler
Committed by
Alexandre Julliard
May 15, 2007
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dbghelp: Speed up vector_add by avoiding pool_realloc calls. Remove no longer needed pool_realloc.
parent
0acb5810
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
32 deletions
+18
-32
dbghelp_private.h
dlls/dbghelp/dbghelp_private.h
+1
-2
storage.c
dlls/dbghelp/storage.c
+17
-30
No files found.
dlls/dbghelp/dbghelp_private.h
View file @
f94127f2
...
...
@@ -44,8 +44,6 @@ struct pool /* poor's man */
void
pool_init
(
struct
pool
*
a
,
unsigned
arena_size
);
void
pool_destroy
(
struct
pool
*
a
);
void
*
pool_alloc
(
struct
pool
*
a
,
unsigned
len
);
/* void* pool_realloc(struct pool* a, void* p,
unsigned old_size, unsigned new_size); */
char
*
pool_strdup
(
struct
pool
*
a
,
const
char
*
str
);
struct
vector
...
...
@@ -55,6 +53,7 @@ struct vector
unsigned
shift
;
unsigned
num_elts
;
unsigned
num_buckets
;
unsigned
buckets_allocated
;
};
void
vector_init
(
struct
vector
*
v
,
unsigned
elt_sz
,
unsigned
bucket_sz
);
...
...
dlls/dbghelp/storage.c
View file @
f94127f2
...
...
@@ -101,33 +101,6 @@ void* pool_alloc(struct pool* pool, unsigned len)
return
ret
;
}
static
struct
pool_arena
*
pool_is_last
(
const
struct
pool
*
pool
,
const
void
*
p
,
unsigned
old_size
)
{
struct
pool_arena
*
arena
;
for
(
arena
=
pool
->
first
;
arena
;
arena
=
arena
->
next
)
{
if
(
arena
->
current
==
(
const
char
*
)
p
+
old_size
)
return
arena
;
}
return
NULL
;
}
static
void
*
pool_realloc
(
struct
pool
*
pool
,
void
*
p
,
unsigned
old_size
,
unsigned
new_size
)
{
struct
pool_arena
*
arena
;
void
*
new
;
if
((
arena
=
pool_is_last
(
pool
,
p
,
old_size
))
&&
(
char
*
)
p
+
new_size
<=
(
char
*
)
arena
+
pool
->
arena_size
)
{
arena
->
current
=
(
char
*
)
p
+
new_size
;
return
p
;
}
if
((
new
=
pool_alloc
(
pool
,
new_size
))
&&
old_size
)
memcpy
(
new
,
p
,
min
(
old_size
,
new_size
));
return
new
;
}
char
*
pool_strdup
(
struct
pool
*
pool
,
const
char
*
str
)
{
char
*
ret
;
...
...
@@ -155,6 +128,7 @@ void vector_init(struct vector* v, unsigned esz, unsigned bucket_sz)
default:
assert
(
0
);
}
v
->
num_buckets
=
0
;
v
->
buckets_allocated
=
0
;
v
->
num_elts
=
0
;
}
...
...
@@ -180,9 +154,22 @@ void* vector_add(struct vector* v, struct pool* pool)
assert
(
v
->
num_elts
>
ncurr
);
if
(
ncurr
==
(
v
->
num_buckets
<<
v
->
shift
))
{
v
->
buckets
=
pool_realloc
(
pool
,
v
->
buckets
,
v
->
num_buckets
*
sizeof
(
void
*
),
(
v
->
num_buckets
+
1
)
*
sizeof
(
void
*
));
if
(
v
->
num_buckets
==
v
->
buckets_allocated
)
{
/* Double the bucket cache, so it scales well with big vectors.*/
unsigned
new_reserved
;
void
*
new
;
new_reserved
=
2
*
v
->
buckets_allocated
;
if
(
new_reserved
==
0
)
new_reserved
=
1
;
/* Don't even try to resize memory.
Pool datastructure is very inefficient with reallocs. */
new
=
pool_alloc
(
pool
,
new_reserved
*
sizeof
(
void
*
));
memcpy
(
new
,
v
->
buckets
,
v
->
buckets_allocated
*
sizeof
(
void
*
));
v
->
buckets
=
new
;
v
->
buckets_allocated
=
new_reserved
;
}
v
->
buckets
[
v
->
num_buckets
]
=
pool_alloc
(
pool
,
v
->
elt_size
<<
v
->
shift
);
return
v
->
buckets
[
v
->
num_buckets
++
];
}
...
...
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