Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
F
faiss
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
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
钟尚武
faiss
Commits
98b23c87
Commit
98b23c87
authored
Jul 03, 2018
by
Evgeny Savinov
Committed by
Matthijs Douze
Jul 03, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use madvice instead of iteration over data (#503)
parent
e4ef2eff
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
2 deletions
+15
-2
OnDiskInvertedLists.cpp
OnDiskInvertedLists.cpp
+13
-1
OnDiskInvertedLists.h
OnDiskInvertedLists.h
+2
-1
No files found.
OnDiskInvertedLists.cpp
View file @
98b23c87
...
...
@@ -223,7 +223,17 @@ int OnDiskInvertedLists::OngoingPrefetch::global_cs = 0;
void
OnDiskInvertedLists
::
prefetch_lists
(
const
long
*
list_nos
,
int
n
)
const
{
pf
->
prefetch_lists
(
list_nos
,
n
);
if
(
use_madvise
)
{
for
(
int
i
=
0
;
i
<
n
;
++
i
)
{
const
auto
list_no
=
list_nos
[
i
];
const
auto
size
=
list_size
(
list_no
);
madvise
((
void
*
)
get_ids
(
list_no
),
size
*
sizeof
(
Index
::
idx_t
),
MADV_WILLNEED
);
madvise
((
void
*
)
get_codes
(
list_no
),
size
*
code_size
,
MADV_WILLNEED
);
}
}
else
{
pf
->
prefetch_lists
(
list_nos
,
n
);
}
}
...
...
@@ -327,6 +337,7 @@ OnDiskInvertedLists::OnDiskInvertedLists (
totsize
(
0
),
ptr
(
nullptr
),
read_only
(
false
),
use_madvise
(
false
),
locks
(
new
LockLevels
()),
pf
(
new
OngoingPrefetch
(
this
))
{
...
...
@@ -340,6 +351,7 @@ OnDiskInvertedLists::OnDiskInvertedLists ():
totsize
(
0
),
ptr
(
nullptr
),
read_only
(
false
),
use_madvise
(
false
),
locks
(
new
LockLevels
()),
pf
(
new
OngoingPrefetch
(
this
))
{
...
...
OnDiskInvertedLists.h
View file @
98b23c87
...
...
@@ -73,7 +73,8 @@ struct OnDiskInvertedLists: InvertedLists {
size_t
totsize
;
uint8_t
*
ptr
;
// mmap base pointer
bool
read_only
;
/// are inverted lists mapped read-only
bool
use_madvise
;
// use madvice for prefetching
OnDiskInvertedLists
(
size_t
nlist
,
size_t
code_size
,
const
char
*
filename
);
...
...
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