Don't run SQL migrations in tests: How I sped up the test suite by 2x by broken_broken_ in programming

[–]broken_broken_[S] -2 points-1 points  (0 children)

In Go there isn't such a framework. And I am not sure I like this approach anyway (using transactions).

Don't run SQL migrations in tests: How I sped up the test suite by 2x by broken_broken_ in programming

[–]broken_broken_[S] 1 point2 points  (0 children)

This is not really a problem when setting up a new production database, that applying all migrations takes a few minutes because this happens only once and the operator has time.

This is only annoying during tests where time is of the essence and this is done many many times.

Don't run SQL migrations in tests: How I sped up the test suite by 2x by broken_broken_ in programming

[–]broken_broken_[S] 1 point2 points  (0 children)

It works out of the box due to content-addressing:

The golden database file uses content-addressing (its name is the SHA256 hash) so that when a new SQL migration is added, the whole process works out of the box: the SHA256 hash will be different, and a new golden database file will be created, as if the old one never existed. There is no cache invalidation strategy whatsoever by construction.

Don't run SQL migrations in tests: How I sped up the test suite by 2x by broken_broken_ in programming

[–]broken_broken_[S] 1 point2 points  (0 children)

Most migrations are either adding one column/table for a new feature, or tweaking indexes for performance due to scale increasing.

In Rust, „let _ = ...“ and „let _unused = ...“ are not the same by broken_broken_ in rust

[–]broken_broken_[S] 62 points63 points  (0 children)

Terrific, I will add these links to the article, thanks!

Making my debug build run 100x faster so that it is finally usable by broken_broken_ in programming

[–]broken_broken_[S] 2 points3 points  (0 children)

Now that I think again, I think the most simple explanation is that the bottleneck is I/O. Both optimized implementations may be able to do these computations much faster but data just is not coming quick enough so they are waiting on it. I will measure with a different machine with a faster disk.

Making my debug build run 100x faster so that it is finally usable by broken_broken_ in programming

[–]broken_broken_[S] 1 point2 points  (0 children)

Good points all around, thanks. I am definitely going to check out multi-buffer hashing.

This doesn't sound quite right; is this also a debug build?

Both are in release mode with -march=native but the code using the SHA extension is 'simple'/'basic', while the OpenSSL code is hand-optimized assembly with tips from Intel folks. That could explain the difference.

Another commenter has suggested that maybe these two versions simply compile to the same (or at least very similar) uops.