DjangoPeng / DjangoPeng/word2vec
word2vec.c: Minor tweak to reduce CPU pipeline stalls (3% gain)
- Dominant language
- C
- Stars
- 3
- Forks
- 5
- PR merge metrics
- No merged PRs in 30d
Description
```
The perf utility reported a bottleneck in this area, where it's waiting for the
'target' variable to be finalized. By computing the next value of target early,
overall performance is increased by about 3% on a small (128MB) training file.
add next_target next to target in the variable list.
Then in the two negative sampling blocks:
...
if (d == 0) {
target = word;
label = 1;
next_random = next_random * (unsigned long long)25214903917 + 11;
next_target = table[(next_random >> 16) % table_size];
} else {
target = next_target;
if (target == 0) target = next_random % (vocab_size - 1) + 1;
next_random = next_random * (unsigned long long)25214903917 + 11;
next_target = table[(next_random >> 16) % table_size];
if (target == word) continue;
label = 0;
}
...
```
Original issue reported on code.google.com by `chad.p...@gmail.com` on 22 Jul 2015 at 6:40
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.