-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Use faster way to get sec and nsec #2557
Conversation
it's faster than Time.now Signed-off-by: Yuta Iwama <[email protected]>
Signed-off-by: Yuta Iwama <[email protected]>
6076a3e
to
55bc09d
Compare
memo: timecop's issue. travisjeffery/timecop#220 |
55bc09d
to
191a2ea
Compare
Signed-off-by: Yuta Iwama <[email protected]>
lib/fluent/time.rb
Outdated
@@ -111,7 +111,8 @@ def self.eq?(a, b) | |||
end | |||
|
|||
def self.now | |||
from_time(Time.now) | |||
now = Fluent::Clock.real_now(:nanosecond) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
EventTime.now
is called frequently so how about call Process.clock_gettime
directly to reduce function call?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed 809af50
…ly instead of Fluent::Clock.real_now Signed-off-by: Yuta Iwama <[email protected]>
191a2ea
to
809af50
Compare
Which issue(s) this PR fixes:
no
What this PR does / why we need it:
Process.clock_gettime
is faster thanTime.now
if getting sec and nsec.and
Time.now
is called inEventTime.now
.EventTime.now is called per data in parser_none and per chunk creation. so it's better to replace them with faster version's method.
Docs Changes:
no need
Release Note:
same as title