-
-
Notifications
You must be signed in to change notification settings - Fork 405
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
Refactor performance for montecarlo #2792
Refactor performance for montecarlo #2792
Conversation
Signed-off-by: Asish Kumar <[email protected]>
Signed-off-by: Asish Kumar <[email protected]>
Signed-off-by: Asish Kumar <[email protected]>
*beep* *bop* 2 PIE790 [*] Unnecessary `pass` statement
2 I001 [*] Import block is un-sorted or un-formatted
2 D411 [*] Missing blank line before section ("Parameters")
2 UP004 [*] Class `RPacketLastInteractionTracker` inherits from `object`
1 RET505 [ ] Unnecessary `else` after `return` statement
1 D202 [*] No blank lines allowed after function docstring (found 1)
1 D412 [*] No blank lines allowed between a section header and its content ("Parameters")
Complete output(might be large): tardis/transport/montecarlo/packet_source.py:1:1: I001 [*] Import block is un-sorted or un-formatted
tardis/transport/montecarlo/packet_source.py:228:9: D202 [*] No blank lines allowed after function docstring (found 1)
tardis/transport/montecarlo/packet_source.py:246:9: RET505 Unnecessary `else` after `return` statement
tardis/transport/montecarlo/packet_source.py:270:9: D412 [*] No blank lines allowed between a section header and its content ("Parameters")
tardis/transport/montecarlo/packet_trackers.py:1:1: I001 [*] Import block is un-sorted or un-formatted
tardis/transport/montecarlo/packet_trackers.py:36:22: UP004 [*] Class `RPacketTracker` inherits from `object`
tardis/transport/montecarlo/packet_trackers.py:39:5: D411 [*] Missing blank line before section ("Parameters")
tardis/transport/montecarlo/packet_trackers.py:226:37: UP004 [*] Class `RPacketLastInteractionTracker` inherits from `object`
tardis/transport/montecarlo/packet_trackers.py:229:5: D411 [*] Missing blank line before section ("Parameters")
tardis/transport/montecarlo/packet_trackers.py:271:9: PIE790 [*] Unnecessary `pass` statement
tardis/transport/montecarlo/packet_trackers.py:278:9: PIE790 [*] Unnecessary `pass` statement
Found 11 errors.
[*] 10 fixable with the `--fix` option.
|
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #2792 +/- ##
==========================================
- Coverage 69.91% 69.37% -0.54%
==========================================
Files 206 206
Lines 15523 15524 +1
==========================================
- Hits 10853 10770 -83
- Misses 4670 4754 +84 ☔ View full report in Codecov by Sentry. |
*beep* *bop* Significantly changed benchmarks: All benchmarks: Benchmarks that have stayed the same:
| Change | Before [8a317dd9] <master> | After [fd18ffd8] | Ratio | Benchmark (Parameter) |
|----------|------------------------------|---------------------|---------|-------------------------------------------------------------------------------------------------------------------------------------|
| | 7.04±2μs | 9.75±2μs | ~1.38 | transport_montecarlo_vpacket.BenchmarkMontecarloMontecarloNumbaVpacket.time_trace_vpacket_volley |
| | 45.7±20μs | 57.1±20μs | ~1.25 | transport_montecarlo_interaction.BenchmarkTransportMontecarloInteraction.time_line_emission |
| | 551±200ns | 621±200ns | ~1.13 | opacities_opacity.BenchmarkMontecarloMontecarloNumbaOpacities.time_photoabsorption_opacity_calculation |
| | 3.35±0.3μs | 2.99±0.5μs | ~0.90 | transport_montecarlo_vpacket.BenchmarkMontecarloMontecarloNumbaVpacket.time_trace_bad_vpacket |
| | 66.2±0.3ms | 57.2±0.4ms | ~0.86 | transport_montecarlo_packet_trackers.BenchmarkTransportMontecarloPacketTrackers.time_rpacket_trackers_to_dataframe |
| | 511±200ns | 561±100ns | 1.10 | opacities_opacity.BenchmarkMontecarloMontecarloNumbaOpacities.time_compton_opacity_calculation |
| | 1.42±0.4μs | 1.56±0.3μs | 1.10 | transport_geometry_calculate_distances.BenchmarkTransportGeometryCalculateDistances.time_calculate_distance_line |
| | 2.69±0.02ms | 2.88±0.01ms | 1.07 | opacities_opacity_state.BenchmarkOpacitiesOpacityState.time_opacity_state_initialize('scatter') |
| | 7.02±1μs | 7.27±1μs | 1.04 | transport_montecarlo_vpacket.BenchmarkMontecarloMontecarloNumbaVpacket.time_trace_vpacket |
| | 31.3±0.03μs | 31.7±0.05μs | 1.01 | transport_montecarlo_packet_trackers.BenchmarkTransportMontecarloPacketTrackers.time_generate_rpacket_tracker_list |
| | 39.5±0.02s | 39.6±0.01s | 1.00 | run_tardis.BenchmarkRunTardis.time_run_tardis |
| | 2.07±0m | 2.07±0m | 1.00 | spectrum_formal_integral.BenchmarkTransportMontecarloFormalIntegral.time_FormalIntegrator_functions |
| | 3.53±0.3μs | 3.54±0.5μs | 1.00 | transport_montecarlo_vpacket.BenchmarkMontecarloMontecarloNumbaVpacket.time_trace_vpacket_within_shell |
| | 3.63±0.05ms | 3.61±0.01ms | 0.99 | opacities_opacity_state.BenchmarkOpacitiesOpacityState.time_opacity_state_initialize('macroatom') |
| | 207±0.1ns | 206±0.08ns | 0.99 | spectrum_formal_integral.BenchmarkTransportMontecarloFormalIntegral.time_intensity_black_body |
| | 44.4±30μs | 43.8±20μs | 0.99 | transport_montecarlo_interaction.BenchmarkTransportMontecarloInteraction.time_line_scatter |
| | 758±0.4ns | 751±0.9ns | 0.99 | transport_montecarlo_interaction.BenchmarkTransportMontecarloInteraction.time_thomson_scatter |
| | 551±100ns | 541±200ns | 0.98 | opacities_opacity.BenchmarkMontecarloMontecarloNumbaOpacities.time_pair_creation_opacity_calculation |
| | 1.05±0m | 1.03±0m | 0.98 | run_tardis.BenchmarkRunTardis.time_run_tardis_rpacket_tracking |
| | 2.56±0.4ms | 2.52±0.4ms | 0.98 | transport_montecarlo_single_packet_loop.BenchmarkTransportMontecarloSinglePacketLoop.time_single_packet_loop |
| | 1.24±0μs | 1.20±0μs | 0.97 | transport_geometry_calculate_distances.BenchmarkTransportGeometryCalculateDistances.time_calculate_distance_boundary |
| | 2.22±2μs | 2.16±2μs | 0.97 | transport_montecarlo_estimators_radfield_estimator_calcs.BenchmarkMontecarloMontecarloNumbaPacket.time_update_line_estimators |
| | 1.75±0.03ms | 1.65±0ms | 0.94 | transport_montecarlo_main_loop.BenchmarkTransportMontecarloMontecarloMainLoop.time_montecarlo_main_loop |
| | 25.3±6μs | 23.2±6μs | 0.92 | transport_montecarlo_packet_trackers.BenchmarkTransportMontecarloPacketTrackers.time_generate_rpacket_last_interaction_tracker_list |
If you want to see the graph of the results, you can check it here |
Signed-off-by: Asish Kumar <[email protected]>
@@ -287,9 +290,10 @@ def generate_rpacket_tracker_list(no_of_packets, length): | |||
------- | |||
A list containing RPacketTracker for each RPacket | |||
""" | |||
rPacketTracker = RPacketTracker(length) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please readup on PEP8 naming schemes
Signed-off-by: Asish Kumar <[email protected]>
Signed-off-by: Asish Kumar <[email protected]>
@officialasishkumar did you verify that this produces a significant performance improvement? |
Not significant but slight performance improvement. |
📝 Description
Type: refactor
📌 Resources
Examples, notebooks, and links to useful references.
🚦 Testing
How did you test these changes?
☑️ Checklist
build_docs
label