GitHub Web Link: https://github.com/txaty/gool
There are currently numerous excellent Goroutine swimming pool applications, and also I like their styles a lot.
Right here I publish my very own. I made this collection numerous months ago for the identical implementation of the Merkle Tree collection
Although the expenses of Goroutine is substantially less than a normal string, procedure, merging, and also recycling goroutines home can still assist enhance the program efficiency (and also it did assist with the efficiency of the Merkle Tree collection).
The techniques of my goroutine swimming pool are similar to Python ThreadPoolExecutor:
-
Submit
: Send a job and also return the outcome (if any kind of). -
AsyncSubmit
: Send a job and also return a future of the outcome (if any kind of). The future is the outcome network. -
Map
: Send a package of jobs and also return the cause order (if any kind of). -
AsyncMap
: Send a package of jobs and also return the futures of the outcomes (if any kind of). The futures are the outcome networks.
To utilize it, you require to specify the following:
- Trainer feature: trainer
func( A) R
, and also - Disagreement:
arg A
With kinds A
and also R
being approximate common kinds.
When producing a brand-new swimming pool, you can define the variety of employees numWorkers and also the job line up dimension cap.
Please do not hesitate to have a look and also offer some remarks. Many thanks!
1 Like
Hi @tommytim0515,
Your collection is rather good, and also can be an important device for numerous. Yet, it can likewise take advantage of the complying with enhancements:
- include instances in the readme, instances on exactly how to utilize it
- include device examinations, for both swimming pool and also employee (each public technique ought to have a system examination)
- include an instances folder with an example application utilizing it
- include bundle remarks
- include technique remarks
- include even more details in the readme (exactly how to examine, what are the constraints, criteria)
- include criteria
- include stylish closure
- include a means to set up the swimming pool with the “max quantity of time a work is permitted to run, prior to it obtains terminated”; if your work take also long they will certainly hog up the employees and also all blocks
- examination its limitations, include a layout revealing the CPU rely on one axis, and also limit work qualified to run (for the very same simulated work) without obstructing or collapsing
- include a smoke examination (this remains in a different data)
- include a user interface with the techniques subject to the individual, and also a technique to develop an item applying it
- include linters
- include a CI pipe config for it
- include a Dockerfile to develop a photo of it, and also upload that picture to a windows registry
- repair the pests (ask chatGPT concerning this)
- include far better concurrency assistance
1 Like
Your comprehensive remark is extremely valued!