Results 1 to 6 of 6

Thread: fgets_sse2

  1. #1
    Member
    Join Date
    Jun 2013
    Location
    USA
    Posts
    98
    Thanks
    4
    Thanked 14 Times in 12 Posts

    fgets_sse2

    https://hashcat.net/forum/thread-1912.html

    This came out a while ago but I only recently started to use it. It's 7 times faster than cygwin's fgets and 4 times faster than the standard glibc. No clue if anyone will find it useful.

  2. #2
    Member
    Join Date
    Feb 2013
    Location
    San Diego
    Posts
    1,057
    Thanks
    54
    Thanked 71 Times in 55 Posts
    I tried it, and it's fast. I ran into some odd behavior, like you did. There could be bugs lurking in all that code, but I think the significant part is this, where it looks like it's scanning for newlines using SSE:

    __m128i mask = _mm_set1_epi32 (0x0a0a0a0a);

    __m128i *ptr = (__m128i *) ctx->buf;

    for (i = 0; i < num; i += 16)
    {
    __m128i tmp = _mm_cmpeq_epi8 (mask, *ptr++);

    const int k = _mm_movemask_epi8 (tmp);


    It could probably be adapted to perform other tasks.

  3. #3
    Programmer Bulat Ziganshin's Avatar
    Join Date
    Mar 2007
    Location
    Uzbekistan
    Posts
    4,497
    Thanks
    733
    Thanked 659 Times in 354 Posts
    it's sse4 string operation command set, targted exactly at this sort of tasks

  4. #4
    Member
    Join Date
    Feb 2013
    Location
    San Diego
    Posts
    1,057
    Thanks
    54
    Thanked 71 Times in 55 Posts
    They don't seem to be quite as specialized as the AVX string instructions.

  5. #5
    Programmer Bulat Ziganshin's Avatar
    Join Date
    Mar 2007
    Location
    Uzbekistan
    Posts
    4,497
    Thanks
    733
    Thanked 659 Times in 354 Posts
    what's the avx string instructions?

  6. #6
    Member
    Join Date
    Feb 2013
    Location
    San Diego
    Posts
    1,057
    Thanks
    54
    Thanked 71 Times in 55 Posts
    Quote Originally Posted by Bulat Ziganshin View Post
    what's the avx string instructions?
    I'm referring to PCMPESTRI, etc. I guess they are actually part of SSE4.2, not AVX.

Posting Permissions

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