Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Michael Krause
burnpy
Commits
0f8fece3
Commit
0f8fece3
authored
Apr 17, 2020
by
Michael Krause
🎉
Browse files
Output number of threads in use
parent
e34f878e
Pipeline
#5791
passed with stage
in 48 seconds
Changes
1
Pipelines
4
Hide whitespace changes
Inline
Side-by-side
burn.py
View file @
0f8fece3
...
...
@@ -52,7 +52,7 @@ def burn(hours, threads):
c
=
10
**
(
1
-
36
*
log10
(
1.618
))
n
=
log10
(
hours
*
3600
/
c
)
/
log10
(
1.618
)
n
=
int
(
floor
(
n
))
print
(
"Burning {} hours by stupidly calculating fib({})
.
"
.
format
(
hours
,
n
))
print
(
"Burning {} hours by stupidly calculating fib({})
, using {} thread(s)
"
.
format
(
hours
,
n
,
threads
))
with
ProcessPoolExecutor
(
max_workers
=
threads
)
as
pool
:
futures
=
{
pool
.
submit
(
fib
,
n
)
for
i
in
range
(
threads
)}
for
index
,
future
in
enumerate
(
as_completed
(
futures
)):
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment