sql-migrate icon indicating copy to clipboard operation
sql-migrate copied to clipboard

Build optimizations?

Open chakrit opened this issue 9 years ago • 2 comments

Of all the dependencies in my project, sql-migrate is the slowest to build on a clean run. I think this was because of the references to all the database drivers included.

Is there a way to speed this up?

chakrit avatar Jul 31 '15 04:07 chakrit

What helps a lot is running go install github.com/mattn/go-sqlite3. Same thing probably applies for the other database engines.

This doesn't help you for a clean compile (it's all the cgo stuff in there that makes it slow), but avoids it for subsequent compiles.

rubenv avatar Jul 31 '15 05:07 rubenv

How about injecting the db engines with sub packages, the way it's done with init(), sql pkg and all it's available drivers? That way you don't have to worry about heavy pkgs like sqlite.

Example:

import (
        "github.com/rubenv/sql-migrate"
        _ "github.com/rubenv/sql-migrate/sqlite3"
        _ "github.com/mattn/go-sqlite3"
)

Had a quick look and it seemed it's only config.go and migrate.go that imports all engines in the same place, so it feels pretty easy to split them up?

lmas avatar Jan 02 '21 17:01 lmas