xxHash slow
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2

Thread: xxHash slow

  1. #1
    Join Date
    Apr 2017
    Posts
    1

    Unhappy xxHash slow

    Hello , i'm very new to C++ so please be tolerate if I slow to understand.
    I just found an open source library called 'xxHash' ( https://github.com/Cyan4973/xxHash ). As the project said it's an extremely fast hash algorithm - faster than CRC32, with the speed can reach 5.4 GB/s.

    I tried to test it on my core-i3 6100u (2 core x 2.3Ghz) but I found the speed is very different :
    Code:
    #include "stdafx.h"
    #include "xxhash.c"
    #include <iostream>
    #include <string>
    #include "Windows.h"
    #include "Winbase.h"
    
    int _tmain(int argc, _TCHAR* argv[])
    {
    const	byte* ip = new byte[4000000];
    
    int currentTick=	GetTickCount();
    	 int32 abc2=  XXH32(ip ,  4000000 , 0);
     int endTick=	GetTickCount();
     uint32_t final= endTick-currentTick;
     cout << final << endl;
    
     std::string s;
     std::getline(std::cin, s);
    }
    The output said that it take ~103 ms to calculate hash of a 4MB memory region. So it roughly 40MB/s . How do I get the super speed 5.4 GB/s like the owner say? Is there any mistake I have made on my code?

  2. #2
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Wallisellen (ZH), Switzerland
    Posts
    18,997

    Re: xxHash slow

    Did you test the Release or Debug build?
    Victor Nijegorodov

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This a Codeguru.com survey!


On-Demand Webinars (sponsored)