question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

List.traverseResultA and friends have x @ y on the error branch, this could potentially blow up

See original GitHub issue

Describe the bug The List.traverseResultA function and similar ones have this critical path:

            match state, fR with
            | Ok ys, Ok y -> traverseResultA' (Ok(y :: ys)) f xs
            | Error errs, Error e -> traverseResultA' (Error(errs @ e)) f xs
            | Ok _, Error e
            | Error e, Ok _ -> traverseResultA' (Error e) f xs

Namely: Error(errs @ e).

If you have many errors (in my situation is was importing an Excel file and all cells in a column were bad), the performance is exponential.

To solve this, one way would be a simple fix to just e :: errs the errors and do a List.rev at the end.

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:5

github_iconTop GitHub Comments

1reaction
abelbraaksmacommented, Oct 20, 2022

Change looks good, thanks!

1reaction
TheAngryByrdcommented, May 5, 2022

Ouch, yeah that’s bad. I mentioned the error path needs to be considered as well in https://github.com/demystifyfp/FsToolkit.ErrorHandling/issues/167 when doing a performance pass at it.

Read more comments on GitHub >

github_iconTop Results From Across the Web

git - Creating a (feature) subbranch results in the error "fatal ...
Tried to create feature/featureName. Got the error fatal: cannot lock ref 'refs/heads/feature/FeatureName': 'refs/heads/feature' exists.
Read more >
Untitled
#run Http www 17track net en track, Can i get my provisional licence at 16, ... football live scores today, Friends the one...
Read more >
Untitled
#New Aiims 2018 result date, Arti two face, Gta 5 online stunt jumps, 4 10 16 sequence ... Teko espresso coffee, Can we...
Read more >
My thoughts on Rust and C++
Background I'm a C++ programmer who has been hearing about Rust for ... (And similarly, one could easily argue “Rust Errors > C...
Read more >
Untitled
Meftah wilaya blida, Thai chow fort branch hours, Brocante 2014 marne, ... Saint seiya mauren mp3, Life is ten percent, List of oxidizing...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found