I don't know what version of Factor you are using, but I made a couple
improvements improvements to sha checksums over the last year or two.

I can hash a 17 mb file in 4.5 seconds on my laptop:

    IN: scratchpad "~/testfile" file-info size>> .
    17825792

    IN: scratchpad gc [ "~/testfile" sha-256 checksum-file ] time
    Running time: 4.533698574 seconds

There is still a lot of optimization potential because it doesn't inline
fixnum arithmetic completely on 64-bit.  I was working on it awhile ago and
didn't quite finish.

If you really need performance now, here's another way that calls out to
``shasum`` and is fast.

    : shasum ( path -- checksum )
        absolute-path { "shasum" "-a" "256" } swap suffix
        utf8 [ readln ] with-process-reader " " split1 drop ;

    IN: scratchpad [ "~/testfile" shasum ] time
    Running time: 0.206797194 seconds

Hope that helps.

Best,
John.




On Mon, Sep 21, 2015 at 12:09 PM, Alexander Ilin <ajs...@yandex.ru> wrote:

> Hello!
>
>   I just found out that calculation of SHA-256 checksum for a 17 Mb file
> takes about 200 seconds!
>   Does anyone have an idea how to improve that figure by at least two
> orders of magnitude?
>   sha256sum.exe does same in under 1 second.
>
> ---=====---
>  Александр
>
>
> ------------------------------------------------------------------------------
> _______________________________________________
> Factor-talk mailing list
> Factor-talk@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/factor-talk
>
------------------------------------------------------------------------------
_______________________________________________
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk

Reply via email to