-
-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Infinite loop #16
Comments
Thanks for reporting this! and sorry for the delay in investigating it I suspect it wasn't actually getting stuck in an infinite loop, but actually just taking a really long time to generate. I have recently optimized the AST formatter quite a lot on exactly these types of complex nested data types, and testing with those changes your tests complete in 4.6s now and update as expected. Your data structure is pretty complex, though, so if you aren't happy with the 4.6s time that will probably be why - the two files clock in around 10k lines total: slimsag/autogold-infinite-loop-issue@c5415f6 In any case, |
With complex data types, this can provide a 66% performance improvement. Before: ``` $ go test -bench=. goos: darwin goarch: amd64 pkg: github.com/hexops/valast BenchmarkComplexType-16 2 564812395 ns/op PASS ok github.com/hexops/valast 9.372s ``` After: ``` $ go test -bench=. goos: darwin goarch: amd64 pkg: github.com/hexops/valast BenchmarkComplexType-16 6 189646854 ns/op PASS ok github.com/hexops/valast 6.379s ``` In practice this can result in tests running much faster, before: ``` --- PASS: TestUnionMerge (6.38s) --- PASS: TestUnionMerge/#00 (1.42s) --- PASS: TestUnionMerge/#1 (1.17s) --- PASS: TestUnionMerge/#2 (2.32s) --- PASS: TestUnionMerge/#3 (0.00s) --- PASS: TestUnionMerge/#4 (0.00s) --- PASS: TestUnionMerge/#5 (1.46s) ``` After: ``` --- PASS: TestUnionMerge (2.96s) --- PASS: TestUnionMerge/#00 (1.05s) --- PASS: TestUnionMerge/#1 (0.77s) --- PASS: TestUnionMerge/#2 (0.77s) --- PASS: TestUnionMerge/#3 (0.00s) --- PASS: TestUnionMerge/#4 (0.00s) --- PASS: TestUnionMerge/#5 (0.37s) ``` Also appears to fix hexops/autogold#16 Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
With complex data types, this can provide a 66% performance improvement. Before: ``` $ go test -bench=. goos: darwin goarch: amd64 pkg: github.com/hexops/valast BenchmarkComplexType-16 2 564812395 ns/op PASS ok github.com/hexops/valast 9.372s ``` After: ``` $ go test -bench=. goos: darwin goarch: amd64 pkg: github.com/hexops/valast BenchmarkComplexType-16 6 189646854 ns/op PASS ok github.com/hexops/valast 6.379s ``` In practice this can result in tests running much faster, before: ``` --- PASS: TestUnionMerge (6.38s) --- PASS: TestUnionMerge/#00 (1.42s) --- PASS: TestUnionMerge/#1 (1.17s) --- PASS: TestUnionMerge/#2 (2.32s) --- PASS: TestUnionMerge/#3 (0.00s) --- PASS: TestUnionMerge/#4 (0.00s) --- PASS: TestUnionMerge/#5 (1.46s) ``` After: ``` --- PASS: TestUnionMerge (2.96s) --- PASS: TestUnionMerge/#00 (1.05s) --- PASS: TestUnionMerge/#1 (0.77s) --- PASS: TestUnionMerge/#2 (0.77s) --- PASS: TestUnionMerge/#3 (0.00s) --- PASS: TestUnionMerge/#4 (0.00s) --- PASS: TestUnionMerge/#5 (0.37s) ``` Also appears to fix hexops/autogold#16 Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
…ne formatting) * 66% performance improvement: hexops/valast#10 * Fixes performance issues on very large structures: #16 * Improves formatting of very long lines: mvdan/gofumpt#70 (comment) Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
Tagged, you can use the following to update:
|
I've come across a possible bug where autogold gets stuck in an infinite loop, and I don't know why.
Here's a simple repo that should be reproducible on your end: https://github.com/randallmlough/autogold-infinite-loop-issue
In the ast package, uncomment the last two tests. Both those get stuck in an infinite loop.
The text was updated successfully, but these errors were encountered: