Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- lines = File.stream!("file_path")
- chunks = File.stream!("file_path",[],2_048)
- hash_fun = fn enum ->
- enum
- |> Enum.reduce(:crypto.hash_init(:sha),&(:crypto.hash_update(&2, &1)))
- |> :crypto.hash_final()
- |> Base.encode16()
- end
- Benchee.run(%{
- "lines" => fn ->
- lines
- |> hash_fun.()
- end,
- "chunks" => fn ->
- chunks
- |> hash_fun.()
- end
- },
- time: 10,
- memory_time: 2
- )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement