You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jun 11, 2024. It is now read-only.
Introduce parallel processing on places in the code where it is applicable and make sense from a code execution performance perspective. An average CPU nowadays has a multiple cores so it makes sense to transform CPU intensive calculations into parallel processing to gain code execution speed
a crate called Rayon might be used for parallel processing
among other features, Rayon has parallel iterators which may be used to transform code from sequential processing into parallel processing
example code how it's possible to make a code to run in parallel using Rayon parallel iterators:
// instead of writing code like this
let mut sum = 0;
for element in vec_array {
sum += element*element
}
// it would be better to translate above code into this
vec_array.iter().map(|&el| el * el).sum()
// because the above code can be trivially converted to be executed in parallel with Rayon
vec_array.par_iter().map(|&el| el * el).sum()
When using parallelism in a code, shared resources between different threads need to be protected by not having simultaneous operations on them. If two different threads want to change a shared resource it might occur that this resource will be in invalid state if it won't be locked before any write occurs.
a crate called parking_lot might be used for locking a shared resources
where applicable RwLock may be used because multiple threads can read a shared resource at the same time and only one thread can lock a shared resource for writing purpose
Acceptance Criteria
where applicable code is running in a parallel
some tests before and after introducing parallelism are taken and measurements are documented
Additional Information
some functions in smt.rs file are CPU intensive with a lot of calculations
concentrate on those functions
The text was updated successfully, but these errors were encountered:
Below table shows benchmarking results from before and after code optimizations.
Commit used for before optimizations: 1e5cb1e
Commit used for after optimizations: 7ac861a
Script used for benchmarking: state_long.js
System used: Intel(R) Xeon(R) Platinum 8168 CPU @ 2.70GHz, 8 GB RAM, 50 GB SSD
Description
Introduce parallel processing on places in the code where it is applicable and make sense from a code execution performance perspective. An average CPU nowadays has a multiple cores so it makes sense to transform CPU intensive calculations into parallel processing to gain code execution speed
When using parallelism in a code, shared resources between different threads need to be protected by not having simultaneous operations on them. If two different threads want to change a shared resource it might occur that this resource will be in invalid state if it won't be locked before any write occurs.
RwLock
may be used because multiple threads can read a shared resource at the same time and only one thread can lock a shared resource for writing purposeAcceptance Criteria
Additional Information
The text was updated successfully, but these errors were encountered: