From 178dc5ea6cf00de6ffc88474f8905b0dbfb67b04 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Mon, 15 Feb 2021 12:36:45 -0400 Subject: [PATCH] perf note Following up to f44d4704c638e2fdb48dd0667809b16fac377b5b, I tried making updateIncremental pure, avoiding the IORef overhead. That did not improve speed though. It did complicate the interface since thunks needed to be forced to avoid leaking memory. So am not going with that change. Looking at Crypto.Hash.hashUpdate, it copies a byte array on each call, compared with hashlazy that only uses 1 copy for the whole bytestring. That could well explain a lot of the overhead discussed in the abovementioned commit. Don't see any way to improve that while hashing incrementally, except using bigger chunks should reduce its overhead. Since 10x larger chunks did not, I'm kind of puzzled if it's really what's affecting performance.