-Implements copy_partition, which falls back to deepcopy but is overloaded for <:DiscretePartition and GaussianPartition in this PR.
-copy_message is implemented as the trivial generalization of copy_partition.
-deepcopy calls are replaced with copy_message calls in internal_message_init!.
Note: It is meant for copy_partition and copy_message to replace deepcopy calls throughout the whole package. A follow up PR will carry out the rest of these replacements.
Example with GaussianPartition:
tree = sim_tree(n = 1_000_000)
@time internal_message_init!(tree, GaussianPartition())
# main
10.450746 seconds (50.00 M allocations: 3.178 GiB, 19.87% gc time, 0.05% compilation time)
# PR
1.794678 seconds (20.00 M allocations: 1.032 GiB, 46.68% gc time)
Example with NucleotidePartition:
tree = sim_tree(n = 100_000)
@time internal_message_init!(tree, NucleotidePartition(30))
# main
1.075276 seconds (4.43 M allocations: 1.081 GiB, 23.23% gc time, 1.02% compilation time)
# PR
0.416153 seconds (3.20 M allocations: 912.376 MiB, 58.30% gc time)
Example with both:
tree = sim_tree(n = 100_000)
@time internal_message_init!(tree, [GaussianPartition(), NucleotidePartition(30)])
# main
1.759613 seconds (6.13 M allocations: 1.084 GiB, 13.33% gc time, 0.63% compilation time)
# PR
0.621201 seconds (5.91 M allocations: 971.212 MiB, 41.53% gc time, 9.70% compilation time)
Follow up to PR #6
-Implements
copy_partition
, which falls back todeepcopy
but is overloaded for<:DiscretePartition
andGaussianPartition
in this PR. -copy_message
is implemented as the trivial generalization ofcopy_partition
. -deepcopy
calls are replaced withcopy_message
calls ininternal_message_init!
.Note: It is meant for
copy_partition
andcopy_message
to replacedeepcopy
calls throughout the whole package. A follow up PR will carry out the rest of these replacements.Example with GaussianPartition:
Example with NucleotidePartition:
Example with both: