From ed53ecda0546d6c639fa3d227a59ace4d57b81a5 Mon Sep 17 00:00:00 2001 From: Upasana Date: Mon, 5 Mar 2018 00:58:41 +0100 Subject: Bug 1273381 - Improve bugzilla object performance by using Class::XSAccessor for object accessors --- extensions/Push/lib/BacklogMessage.pm | 7 +++++++ extensions/Push/lib/Backoff.pm | 7 +++++++ extensions/Push/lib/LogEntry.pm | 7 +++++++ extensions/Push/lib/Message.pm | 6 ++++++ extensions/Push/lib/Option.pm | 9 +++++++-- 5 files changed, 34 insertions(+), 2 deletions(-) (limited to 'extensions/Push') diff --git a/extensions/Push/lib/BacklogMessage.pm b/extensions/Push/lib/BacklogMessage.pm index 28b17bae3..7c248a501 100644 --- a/extensions/Push/lib/BacklogMessage.pm +++ b/extensions/Push/lib/BacklogMessage.pm @@ -79,6 +79,13 @@ sub create_from_message { # accessors # +use Class::XSAccessor { + accessors => { + id => __PACKAGE__->ID_FIELD, + name => __PACKAGE__->NAME_FIELD, + }, +}; + sub message_id { return $_[0]->{'message_id'} } sub push_ts { return $_[0]->{'push_ts'}; } sub payload { return $_[0]->{'payload'}; } diff --git a/extensions/Push/lib/Backoff.pm b/extensions/Push/lib/Backoff.pm index f0116a2a7..d0de1310d 100644 --- a/extensions/Push/lib/Backoff.pm +++ b/extensions/Push/lib/Backoff.pm @@ -47,6 +47,13 @@ use constant LIST_ORDER => 'next_attempt_ts'; # accessors # +use Class::XSAccessor { + accessors => { + id => __PACKAGE__->ID_FIELD, + name => __PACKAGE__->NAME_FIELD, + }, +}; + sub connector { return $_[0]->{'connector'}; } sub next_attempt_ts { return $_[0]->{'next_attempt_ts'}; } sub attempts { return $_[0]->{'attempts'}; } diff --git a/extensions/Push/lib/LogEntry.pm b/extensions/Push/lib/LogEntry.pm index f4e894b94..2d45b9ee1 100644 --- a/extensions/Push/lib/LogEntry.pm +++ b/extensions/Push/lib/LogEntry.pm @@ -48,6 +48,13 @@ use constant LIST_ORDER => 'processed_ts DESC'; # accessors # +use Class::XSAccessor { + accessors => { + id => __PACKAGE__->ID_FIELD, + name => __PACKAGE__->NAME_FIELD, + }, +}; + sub message_id { return $_[0]->{'message_id'}; } sub change_set { return $_[0]->{'change_set'}; } sub routing_key { return $_[0]->{'routing_key'}; } diff --git a/extensions/Push/lib/Message.pm b/extensions/Push/lib/Message.pm index 1beb18ef0..d8a7f7a26 100644 --- a/extensions/Push/lib/Message.pm +++ b/extensions/Push/lib/Message.pm @@ -61,6 +61,12 @@ sub create_from_transient { # # accessors # +use Class::XSAccessor { + accessors => { + id => __PACKAGE__->ID_FIELD, + name => __PACKAGE__->NAME_FIELD, + }, +}; sub push_ts { return $_[0]->{'push_ts'}; } sub payload { return $_[0]->{'payload'}; } diff --git a/extensions/Push/lib/Option.pm b/extensions/Push/lib/Option.pm index a08e4c11d..c2e23d513 100644 --- a/extensions/Push/lib/Option.pm +++ b/extensions/Push/lib/Option.pm @@ -35,13 +35,18 @@ use constant VALIDATORS => { connector => \&_check_connector, }; use constant LIST_ORDER => 'connector'; - +use constant NAME_FIELD => 'option_name'; # # accessors # +use Class::XSAccessor { + accessors => { + id => __PACKAGE__->ID_FIELD, + name => __PACKAGE__->NAME_FIELD, + }, +}; sub connector { return $_[0]->{'connector'}; } -sub name { return $_[0]->{'option_name'}; } sub value { return $_[0]->{'option_value'}; } # -- cgit v1.2.3-24-g4f1b