jackfrued / jackfrued/Python-100-Days

day13 例子2计时问题

Open
#359 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Jupyter Notebook
Stars
187k
Forks
55.8k
PR merge metrics
No merged PRs in 30d

Description

在启动8个进程统计时间这块有点问题

  # 启动8个进程将数据切片后进行运算
    for _ in range(8):
        p = Process(target=task_handler,
                    args=(number_list[index:index + 12500000], result_queue))
        index += 12500000
        processes.append(p)
        p.start()
    # 开始记录所有进程执行完成花费的时间
    start = time()
    for p in processes:
        p.join()
    # 合并执行结果
    total = 0

调用process.start()的时候,就已经开始计算了,所以已经把p.start调用放在start = time()统计时间的后面,不然统计时间有问题的。

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Open the Day 13 Example 2 notebook and inspect the multiprocessing timing block shown in the issue. Check when the timer starts relative to process.start() and process.join(); done means the measured interval covers the complete process execution, including startup, and the example remains runnable.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
performance
Issue type
Bug
Difficulty
1/5
Estimated time
Under an hour
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.