tweag / webauthn

A library for parsing and validating webauthn/fido2 credentials
Apache License 2.0
34 stars 11 forks source link

Dependency updates and some cleanups #76

Closed infinisil closed 2 years ago

infinisil commented 2 years ago

See commit messages for changes

infinisil commented 2 years ago

Two problems:

infinisil commented 2 years ago

Looking at compilation times of individual modules, all modules compile within seconds, except these:

And the common thing among these modules is that they use deriving-aeson to derive JSON instances for a lot of data types. Safe to say, that package is causing the slowdown with this PR.

I'll continue investigating.

infinisil commented 2 years ago

Here's the full log of a compilation with -v and timestamps: log.txt

infinisil commented 2 years ago

The performance problem doesn't appear to be related to haskell.nix, because it's the same even when I tried to switch to the nixpkgs Haskell infrastructure, see https://github.com/tweag/webauthn/tree/nixpkgs-haskell

infinisil commented 2 years ago

Turns out that the problem only appears with aeson >= 2.0. I'll try to create a small reproducible example to report to probably https://hackage.haskell.org/package/deriving-aeson

infinisil commented 2 years ago

I reported the performance problem in https://github.com/fumieval/deriving-aeson/issues/16, having created a reproducible minimal example in https://github.com/tweag/webauthn/tree/deriving-aeson-slow-repro

infinisil commented 2 years ago

I fixed the bash problem on macOS by just not using nix-shell anymore. But now we're running into a segfault on darwin:

/Users/runner/work/_temp/2190ff6f-868b-4043-9299-11dfd6567307.sh: line 1: 18790 Segmentation fault: 11  nix-build -A webauthn.checks

This seems to be the same as issue https://github.com/NixOS/nix/issues/5125

infinisil commented 2 years ago

Since this seems to be related to import-from-derivation, and I already did the work of getting the nixpkgs haskell infra to work in https://github.com/tweag/webauthn/tree/nixpkgs-haskell, I'm just gonna switch to that. This will also speed up CI and nix-shells