Skip to content
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

Remove TypedBuilder from db_views and db_views_actor #3637

Merged
merged 4 commits into from
Jul 17, 2023

Conversation

dullbananas
Copy link
Collaborator

@dullbananas dullbananas commented Jul 16, 2023

When re-running the first cargo clippy command in fix-clippy.sh, the build time of db_views is now 311.1s instead of 1281.9s

Helps with #3610

pub async fn list(self) -> Result<Vec<PersonMentionView>, Error> {
let conn = &mut get_conn(self.pool).await?;
impl PersonMentionQuery {
pub async fn list(self, pool: &mut DbPool<'_>) -> Result<Vec<PersonMentionView>, Error> {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feared that the code would get much uglier without builder, but this together with derive(Default) is actually a very clean solution.

@Nutomic
Copy link
Member

Nutomic commented Jul 17, 2023

Wow great find, thanks! If my measurements are correct, this decreases the time for incremental build from 2m 16s to 42s. I will go ahead and merge it immediately because its such a major improvement.

@Nutomic Nutomic merged commit 88215bf into LemmyNet:main Jul 17, 2023
pub is_mod_or_admin: Option<bool>,
pub show_nsfw: Option<bool>,
pub page: Option<i64>,
pub limit: Option<i64>,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Btw the bools dont need to use option as they already default to false. Also other members could work without Option, by deriving Default manually and setting the default values there instead of inside list().

Nutomic pushed a commit to cetra3/lemmy that referenced this pull request Jul 19, 2023
* change pool fields to parameters for list

* remove my_person_id and admin fields

* Change recipient id to list param

* Remove TypedBuilder from db_views and db_views_actor
@Nutomic
Copy link
Member

Nutomic commented Jul 27, 2023

I noticed that typed-builder is still used in db_schema and utils. If it has such a major negative effect on compile time, we should also get rid of it there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants