Improve common function execution speed by inlining

This commit is contained in:
Tobie Morgan Hitchcock 2022-04-01 11:18:14 +01:00
parent bf1a833a79
commit 4dea5c72ee

View file

@ -87,6 +87,7 @@ impl fmt::Display for Statement {
impl Statement { impl Statement {
// Returns any query fields if specified // Returns any query fields if specified
#[inline]
pub fn expr(self: &Statement) -> Option<&Fields> { pub fn expr(self: &Statement) -> Option<&Fields> {
match self { match self {
Statement::Select(v) => Some(&v.expr), Statement::Select(v) => Some(&v.expr),
@ -94,6 +95,7 @@ impl Statement {
} }
} }
// Returns any SET clause if specified // Returns any SET clause if specified
#[inline]
pub fn data(self: &Statement) -> Option<&Data> { pub fn data(self: &Statement) -> Option<&Data> {
match self { match self {
Statement::Create(v) => v.data.as_ref(), Statement::Create(v) => v.data.as_ref(),
@ -102,6 +104,7 @@ impl Statement {
} }
} }
// Returns any WHERE clause if specified // Returns any WHERE clause if specified
#[inline]
pub fn conds(self: &Statement) -> Option<&Cond> { pub fn conds(self: &Statement) -> Option<&Cond> {
match self { match self {
Statement::Select(v) => v.cond.as_ref(), Statement::Select(v) => v.cond.as_ref(),
@ -111,6 +114,7 @@ impl Statement {
} }
} }
// Returns any SPLIT clause if specified // Returns any SPLIT clause if specified
#[inline]
pub fn split(self: &Statement) -> Option<&Splits> { pub fn split(self: &Statement) -> Option<&Splits> {
match self { match self {
Statement::Select(v) => v.split.as_ref(), Statement::Select(v) => v.split.as_ref(),
@ -118,6 +122,7 @@ impl Statement {
} }
} }
// Returns any GROUP clause if specified // Returns any GROUP clause if specified
#[inline]
pub fn group(self: &Statement) -> Option<&Groups> { pub fn group(self: &Statement) -> Option<&Groups> {
match self { match self {
Statement::Select(v) => v.group.as_ref(), Statement::Select(v) => v.group.as_ref(),
@ -125,6 +130,7 @@ impl Statement {
} }
} }
// Returns any ORDER clause if specified // Returns any ORDER clause if specified
#[inline]
pub fn order(self: &Statement) -> Option<&Orders> { pub fn order(self: &Statement) -> Option<&Orders> {
match self { match self {
Statement::Select(v) => v.order.as_ref(), Statement::Select(v) => v.order.as_ref(),
@ -132,6 +138,7 @@ impl Statement {
} }
} }
// Returns any FETCH clause if specified // Returns any FETCH clause if specified
#[inline]
pub fn fetch(self: &Statement) -> Option<&Fetchs> { pub fn fetch(self: &Statement) -> Option<&Fetchs> {
match self { match self {
Statement::Select(v) => v.fetch.as_ref(), Statement::Select(v) => v.fetch.as_ref(),
@ -139,6 +146,7 @@ impl Statement {
} }
} }
// Returns any START clause if specified // Returns any START clause if specified
#[inline]
pub fn start(self: &Statement) -> Option<&Start> { pub fn start(self: &Statement) -> Option<&Start> {
match self { match self {
Statement::Select(v) => v.start.as_ref(), Statement::Select(v) => v.start.as_ref(),
@ -146,6 +154,7 @@ impl Statement {
} }
} }
// Returns any LIMIT clause if specified // Returns any LIMIT clause if specified
#[inline]
pub fn limit(self: &Statement) -> Option<&Limit> { pub fn limit(self: &Statement) -> Option<&Limit> {
match self { match self {
Statement::Select(v) => v.limit.as_ref(), Statement::Select(v) => v.limit.as_ref(),
@ -153,6 +162,7 @@ impl Statement {
} }
} }
// Returns any RETURN clause if specified // Returns any RETURN clause if specified
#[inline]
pub fn output(self: &Statement) -> Option<&Output> { pub fn output(self: &Statement) -> Option<&Output> {
match self { match self {
Statement::Create(v) => v.output.as_ref(), Statement::Create(v) => v.output.as_ref(),
@ -164,6 +174,7 @@ impl Statement {
} }
} }
// Returns any VERSION clause if specified // Returns any VERSION clause if specified
#[inline]
pub fn version(self: &Statement) -> Option<&Version> { pub fn version(self: &Statement) -> Option<&Version> {
match self { match self {
Statement::Select(v) => v.version.as_ref(), Statement::Select(v) => v.version.as_ref(),