-
Notifications
You must be signed in to change notification settings - Fork 13.3k
libtime: alter strftime to use a TmFmt #18556
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
Conversation
r? @alexcrichton or someone? |
This is currently showing up as a major slowdown in hyper, so would really appreciate an r here. |
Hm, the usage of I'm perfectly ok with returning an object that implements |
Ah, good point. I can make it return a Result. Ideally, the specialized functions could skip the validation, since we know On Fri, Nov 7, 2014, 11:43 AM Alex Crichton [email protected]
|
ef6f5fc
to
8b6262b
Compare
The internals of strftime were converted to use a single formatter, instead of creating and concatenating a bunch of small strings. This showed ~3x improvement in the benches. Also, since the formatted time may be going straight to a Writer, TmFmt was introduced, and is returned from all formatting methods on Tm. This allows the saving of another string allocation. Anyone wanting a String can just call .to_string() on the returned value. [breaking-change]
@alexcrichton I've updated to include a |
The internals of strftime were converted to use a single formatter, instead of creating and concatenating a bunch of small strings. This showed ~3x improvement in the benches. Also, since the formatted time may be going straight to a Writer, TmFmt was introduced, and is returned from all formatting methods on Tm. This allows the saving of another string allocation. Anyone wanting a String can just call .to_string() on the returned value. This runs validation prior to return the created `TmFmt`, catching errors before formatting happens. The specialized formats skip this validation, since we already know they are valid. [breaking-change]
The internals of strftime were converted to use a single formatter,
instead of creating and concatenating a bunch of small strings. This
showed ~3x improvement in the benches.
Also, since the formatted time may be going straight to a Writer, TmFmt
was introduced, and is returned from all formatting methods on Tm. This
allows the saving of another string allocation. Anyone wanting a String
can just call .to_string() on the returned value.
This runs validation prior to return the created
TmFmt
, catching errors before formatting happens. The specialized formats skip this validation, since we already know they are valid.[breaking-change]