Skip to content

Conversation

@arnehormann
Copy link
Member

Benchmark at https://gist.github.com/arnehormann/7930795 shows:
1 less allocation, speedup by factor 4+ for non-zero values

utils.go Outdated
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You don't need to cache the length. The great thing about how slices and strings in Go are designed, is that getting the length is just reading an int64 - no indirection, no function calls: MOVQ src+8(FP),BX

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know. It reads smoother to me. But that's a bad habit, I'll change it.

@arnehormann
Copy link
Member Author

PTAL

@julienschmidt
Copy link
Member

LGTM, but it would be nice if we could optimize away the convT2E allocs someday.

@arnehormann
Copy link
Member Author

if you have an idea how to do it, I'm game :)

arnehormann added a commit that referenced this pull request Dec 15, 2013
changed binary date / datetime to string
@arnehormann arnehormann merged commit 948093a into go-sql-driver:master Dec 15, 2013
@arnehormann arnehormann deleted the faster-dateformat branch December 15, 2013 09:56
@julienschmidt julienschmidt added this to the v1.2 milestone Apr 1, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants