Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

improve performance #9

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open

Conversation

starfalling
Copy link

耗时降低至原算法的 1/3 左右

@starfalling
Copy link
Author

40317ab 的提交是增加了性能测试以及程序正确性验证的程序

@@ -72,21 +72,48 @@ public static void load(String filename, boolean strict) throws Exception {
}
}

private static int quickFindInIndexBuffer(long ip2long_value, int start, int end) {
while(true){
int middle = (start + end) / 2;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里相加会overflow吗?下面一句 bitwise 的作用是?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

不会 overflow,因为IP库里面的这个数组个数是有限制的,这不是一个通用的快速查找算法,不需要做溢出判断

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants