-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Optimised performance for attribute extraction #233
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
Disabled all instrumentation unless enabled explicitly
Sorry ... squashed to commits into a different branch and stuff got messy ... anyway ... this should be good |
Awesome :) |
@@ -15,3 +15,4 @@ spec/reports | |||
test/tmp | |||
test/version_tmp | |||
tmp | |||
*.swp |
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.
ha, this is great, I have it in my global .gitignore as well as have vim configured to save these files elsewhere. :)
I was talking with @wycats the other day, and we were discussing how there's probably too much instrumentation already, so I might be sympathetic to just removing it rather than doing all this config work. |
On My Machine:
|
|
||
if self.method_defined? :_fast_attributes | ||
undef :_fast_attributes | ||
end |
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.
Why do we need to define this over and over?
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.
Oh, I guess the idea is that we write out a specific method call, attributes may have changed since the last time we did that?
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.
yeah ... its just for extra safety, it only affects bootup anyway.
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.
Right. I didn't even think about how it's only on boot. We shouldn't actually need it.
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.
yeah, its just a safeguard if people re-open the class for whatever reason. one could argue that is an abuse of the api anyway
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.
Even if they re-open the class, it shouldn't run this code, right? Just if they re-load this file.
I think we can remove this, and then I'll merge it in.
Personally I prefer to remove this stuff, cause we can always inject instrumentation points with MiniProfiler when we need them. Or in my dream world use dtrace in linux .... for this kind of perf work in prd :) |
Sounds good. How about you just remove all of that? |
@steveklabnik may be worth running the bench (just comment out the serializable_hash_with_instrumentation ) against the old code base just to confirm my findings were correct. |
@steveklabnik sure ... let me change that ... one sec |
Reverting the changes made to
Yeah, seems to be pretty dramatic. |
This is great! Huge 👍 to removing instrumentation altogether. If anyone wants instrumentation, they can add it as a separate gem. |
Optimised performance for attribute extraction
👍 |
😯 thanks heaps! |
Thank YOU heaps ❤️ |
@steveklabnik will you be cutting a new release soon with these recent patches? This pert work is awesome. |
Yes. |
Benchmarks (in the benchmark folder) show these changes give 3x perf for serialization under some cases.
I the real world for a big discourse page we see a 10% boost (though it was a bit bigger on 2.0 for some reason):
BEFORE:
AFTER: