Skip to content
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

cmd/gc, time: make Format 5x faster #3679

Closed
rsc opened this issue May 29, 2012 · 8 comments
Closed

cmd/gc, time: make Format 5x faster #3679

rsc opened this issue May 29, 2012 · 8 comments

Comments

@rsc
Copy link
Contributor

rsc commented May 29, 2012

A combination of changes to Format and making the compiler handle strings better can
make time.Format 5x faster than it is now.  Do that.

The experiment justifying this claim is CL 6249062, although that CL is not intended for
submission.  It works around compiler inadequacies instead of addressing them.

benchmark          old ns/op    new ns/op    delta
BenchmarkFormat         2596          507  -80.47%
@davecheney
Copy link
Contributor

Comment 1:

Is Luuk's work in http://golang.org/cl/5966075/ of use here ?

@rsc
Copy link
Contributor Author

rsc commented Jun 3, 2012

Comment 2:

changeset:   13401:bff65816ad27
user:        Russ Cox <rsc@golang.org>
date:        Sun Jun 03 11:08:17 2012 -0400
files:       src/pkg/time/format.go src/pkg/time/time.go
src/pkg/time/time_test.go src/pkg/time/zoneinfo.go
description: time: make Format 2.7x faster
benchmark             old ns/op    new ns/op    delta
BenchmarkFormat            2495          937  -62.44%
BenchmarkFormatNow         2308          889  -61.48%
Update issue #3679.
R=r
CC=golang-dev
http://golang.org/cl/6278047

@remyoudompheng
Copy link
Contributor

Comment 3:

CL 6249062 has disappeared. What was it about and why is this issue still open?

@rsc
Copy link
Contributor Author

rsc commented Sep 11, 2012

Comment 4:

That's too bad. Mainly it was making string manipulation a bit faster. Removing LEAQs
will help. So does special casing x = append(x, "123"...) as x = append(x, '1', '2',
'3') for short strings and also copy(x, "123"). In general I was just unhappy with the
performance of string manipulations.

@rsc
Copy link
Contributor Author

rsc commented Dec 10, 2012

Comment 5:

Labels changed: added size-l.

@rsc
Copy link
Contributor Author

rsc commented Mar 11, 2013

Comment 6:

Rob made memmove a bit faster. Let's call this done as far as Go 1.1 is concerned.

Labels changed: removed go1.1.

@bradfitz
Copy link
Contributor

Comment 7:

Profiling some of the benchmarks from http://www.techempower.com/benchmarks/ recently, I
found we were spending about as much time formatting the optional HTTP "Date" response
header as we were serializing JSON. (at least after
https://golang.org/cl/9129044/)

Labels changed: added performance.

@rsc
Copy link
Contributor Author

rsc commented Jul 30, 2013

Comment 8:

As done as it's going to get.

Status changed to Fixed.

@rsc rsc self-assigned this Jul 30, 2013
@golang golang locked and limited conversation to collaborators Jun 24, 2016
@rsc rsc removed their assignment Jun 22, 2022
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants