and region codes, and I'm trying to decide on which structure to use for
this. The tables will have 200 - 500 rows.
I tested various options and benchmarked them to get a feel for which would
be best, and (using a table with ±200 rows) I've narrowed it down to two
1) Use a long switch statement. This has the advantage of not needing to
have a data structure in memory, and is fairly fast (67-87 ns/op).
2) Use a map which is preloaded in memory. This is a bit faster (38-50
ns/op), but has a long (relative time) to load up in memory of ±38 µs.
So, option 1 seems better for situations where it's called less often, and
2 seems better for situations where a longer setup time is okay, but the
function is called more often. I'm tempted to go with the switch method,
but before I commit to that, I'd like feedback on it, or pointers to any
other examples or methods that have been well executed.
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to firstname.lastname@example.org.
For more options, visit https://groups.google.com/d/optout.