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

Activitypub crate rewrite #2782

Merged
merged 8 commits into from Mar 21, 2023
Merged

Activitypub crate rewrite #2782

merged 8 commits into from Mar 21, 2023

Conversation

Nutomic
Copy link
Member

@Nutomic Nutomic commented Mar 14, 2023

This is finished now. Took some effort to make things work and fix tests. But thanks to previous decoupling of apub and api crates it didnt require any changes in the api crates, otherwise this would have been even more complex.

See the docs for details how the activitypub crate works now: https://docs.rs/activitypub_federation

@Nutomic Nutomic force-pushed the activitpub-crate-rewrite branch 3 times, most recently from 92e5ecc to 6da6023 Compare March 16, 2023 21:01
@Nutomic Nutomic changed the title Activitpub crate rewrite Activitypub crate rewrite Mar 16, 2023
@Nutomic Nutomic marked this pull request as ready for review March 16, 2023 21:02
crates/api_common/src/utils.rs Show resolved Hide resolved
crates/apub/src/activities/mod.rs Show resolved Hide resolved
crates/apub/src/api/resolve_object.rs Show resolved Hide resolved
crates/apub/src/lib.rs Show resolved Hide resolved
crates/apub/src/objects/comment.rs Show resolved Hide resolved
src/api_routes_websocket.rs Show resolved Hide resolved
@Nutomic
Copy link
Member Author

Nutomic commented Mar 17, 2023

Somehow this change has a very bad effect on compilation time for the lemmy_apub crate, went from 20s to 82s. No idea why, but will try to look into it later.

Edit: based on the output of cargo-llvm-lines there is no difference in the llvm lines being generated, so its not a problem of big macro expansions.

this branch:

cargo llvm-lines -p lemmy_apub | head -20
Lines                  Copies               Function name
-----                  ------               -------------
1425016                41694                (TOTAL)
86237 (6.1%,  6.1%)     55 (0.1%,  0.1%)  diesel_async::pg::AsyncPgConnection::with_prepared_statement::{{closure}}
28050 (2.0%,  8.0%)    110 (0.3%,  0.4%)  diesel_async::stmt_cache::StmtCache<DB,S>::cached_prepared_statement::{{closure}}
17140 (1.2%,  9.2%)     55 (0.1%,  0.5%)  diesel_async::stmt_cache::StmtCache<DB,S>::cached_prepared_statement
16908 (1.2%, 10.4%)     12 (0.0%,  0.6%)  activitypub_federation::activity_queue::send_activity::{{closure}}
16244 (1.1%, 11.5%)     31 (0.1%,  0.6%)  lemmy_apub::insert_activity::{{closure}}
13827 (1.0%, 12.5%)    447 (1.1%,  1.7%)  alloc::boxed::Box<T>::pin
12276 (0.9%, 13.4%)    262 (0.6%,  2.3%)  <serde::de::value::MapDeserializer<I,E> as serde::de::MapAccess>::next_value_seed
12110 (0.8%, 14.2%)    362 (0.9%,  3.2%)  core::result::Result<T,E>::map
11610 (0.8%, 15.0%)     54 (0.1%,  3.3%)  <diesel_async::pg::AsyncPgConnection as diesel_async::AsyncConnection>::load::{{closure}}::{{closure}}
11368 (0.8%, 15.8%)    406 (1.0%,  4.3%)  diesel::query_builder::QueryFragment::is_noop

main branch:

cargo llvm-lines -p lemmy_apub | head -20
Compiling lemmy_apub v0.17.1 (/home/felix/workspace/lemmy/lemmy/crates/apub)
Finished dev [unoptimized] target(s) in 32.62s
warning: the following packages contain code that will be rejected by a future version of Rust: syn v0.14.9, xml5ever v0.16.2
note: to see what the problems were, use the option `--future-incompat-report`, or run `cargo report future-incompatibilities --id 5`
Lines                  Copies               Function name
-----                  ------               -------------
1418548                41314                (TOTAL)
86237 (6.1%,  6.1%)     55 (0.1%,  0.1%)  diesel_async::pg::AsyncPgConnection::with_prepared_statement::{{closure}}
28050 (2.0%,  8.1%)    110 (0.3%,  0.4%)  diesel_async::stmt_cache::StmtCache<DB,S>::cached_prepared_statement::{{closure}}
17140 (1.2%,  9.3%)     55 (0.1%,  0.5%)  diesel_async::stmt_cache::StmtCache<DB,S>::cached_prepared_statement
16674 (1.2%, 10.4%)     12 (0.0%,  0.6%)  activitypub_federation::core::activity_queue::send_activity::{{closure}}
14013 (1.0%, 11.4%)    453 (1.1%,  1.7%)  alloc::boxed::Box<T>::pin
12474 (0.9%, 12.3%)    373 (0.9%,  2.6%)  core::result::Result<T,E>::map
12276 (0.9%, 13.2%)    262 (0.6%,  3.2%)  <serde::de::value::MapDeserializer<I,E> as serde::de::MapAccess>::next_value_seed
11751 (0.8%, 14.0%)     12 (0.0%,  3.2%)  lemmy_apub::activities::send_lemmy_activity::{{closure}}::{{closure}}
11610 (0.8%, 14.8%)     54 (0.1%,  3.4%)  <diesel_async::pg::AsyncPgConnection as diesel_async::AsyncConnection>::load::{{closure}}::{{closure}}
11368 (0.8%, 15.6%)    406 (1.0%,  4.3%)  diesel::query_builder::QueryFragment::is_noop

@dessalines
Copy link
Member

Feel free to merge whenever you're ready.

@Nutomic Nutomic enabled auto-merge (squash) March 21, 2023 14:25
@Nutomic Nutomic merged commit 6f51379 into main Mar 21, 2023
makotech222 added a commit to hexbear-collective/lemmy that referenced this pull request Mar 27, 2023
makotech222 added a commit to hexbear-collective/lemmy that referenced this pull request Mar 27, 2023
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.

None yet

2 participants