MCPcopy Index your code
hub / github.com/python/cpython / encode_json_helper

Function encode_json_helper

Lib/test/test_free_threading/test_json.py:6–21  ·  view source on GitHub ↗
(
    json, worker, data, number_of_threads=12, number_of_json_encodings=100
)

Source from the content-addressed store, hash-verified

4
5
6def encode_json_helper(
7 json, worker, data, number_of_threads=12, number_of_json_encodings=100
8):
9 worker_threads = []
10 barrier = Barrier(number_of_threads)
11 for index in range(number_of_threads):
12 worker_threads.append(
13 Thread(target=worker, args=[barrier, data, index])
14 )
15 for t in worker_threads:
16 t.start()
17 for ii in range(number_of_json_encodings):
18 json.dumps(data)
19 data.clear()
20 for t in worker_threads:
21 t.join()
22
23
24class MyMapping(dict):

Calls 7

BarrierClass · 0.90
ThreadClass · 0.90
appendMethod · 0.45
startMethod · 0.45
dumpsMethod · 0.45
clearMethod · 0.45
joinMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…