[issue30423] [asyncio] orphan future close loop and cause "RuntimeError: Event loop stopped before Future completed."

2017-05-21 Thread Jimmy Lai
New submission from Jimmy Lai: Problem: "RuntimeError: Event loop stopped before Future completed." throws when calling run_until_complete(). We investigate and find out some orphan futures stay in the event loop before we run another run_until_complete(another_async_func()).

[issue26171] heap overflow in zipimporter module

2017-05-21 Thread Jimmy Lai
Changes by Jimmy Lai <yuri...@gmail.com>: -- pull_requests: +1794 ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue26171> ___ __

[issue31350] Optimize get_event_loop and _get_running_loop

2017-09-05 Thread Jimmy Lai
New submission from Jimmy Lai: get_event_loop() and _get_running_loop() can be faster. CaseTimeMeanImprove

[issue31350] Optimize get_event_loop and _get_running_loop

2017-09-05 Thread Jimmy Lai
Changes by Jimmy Lai <yuri...@gmail.com>: -- type: -> performance ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue31350> ___ __

[issue31350] asyncio: Optimize get_event_loop and _get_running_loop

2017-09-05 Thread Jimmy Lai
Jimmy Lai added the comment: Benchmark script: Run 10 times to get mean and stdev import asyncio import time async def async_get_loop(): start_time = time.time() for _ in range(500): asyncio.get_event_loop() return time.time() - start_time loop

[issue30423] [asyncio] orphan future close loop and cause "RuntimeError: Event loop stopped before Future completed."

2017-09-04 Thread Jimmy Lai
Changes by Jimmy Lai <yuri...@gmail.com>: -- pull_requests: +3329 ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue30423> ___ __

[issue33505] Optimize asyncio.ensure_future by reordering if conditions

2018-05-14 Thread Jimmy Lai
New submission from Jimmy Lai <yuri...@gmail.com>: `ensure_future` converts the input as future if it's not already a future. The condition is the following: if futures.isfuture(coro_or_future): ... elif coroutines.iscoroutine(coro_or_future): ... elif inspect.isawaitable(coro_or_

[issue33505] Optimize asyncio.ensure_future by reordering if conditions

2018-05-14 Thread Jimmy Lai
Change by Jimmy Lai <yuri...@gmail.com>: -- keywords: +patch pull_requests: +6515 stage: -> patch review ___ Python tracker <rep...@bugs.python.org> <https://bugs.pyt

[issue33505] Optimize asyncio.ensure_future by reordering if conditions

2018-05-14 Thread Jimmy Lai
Change by Jimmy Lai <yuri...@gmail.com>: -- pull_requests: +6518 ___ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue33505> ___ __

[issue33505] Optimize asyncio.ensure_future by reordering if conditions

2018-05-15 Thread Jimmy Lai
Jimmy Lai <yuri...@gmail.com> added the comment: Benchmark result: ./python.exe -m perf compare_to ensure_future_original.json ensure_future_optimized.json Mean +- std dev: [ensure_future_original] 57.4 ms +- 4.0 ms -> [ensure_future_optimized] 49.3 ms +- 4.5 ms: 1.17x fa

[issue33521] Add 1.32x faster C implementation of asyncio.isfuture().

2018-05-19 Thread Jimmy Lai
Jimmy Lai <yuri...@gmail.com> added the comment: @vstinner Thanks for the new benchmark, it provides more detailed wins: It's 1.64x faster for future object and 1.23x faster for non-future object. $ ./python.exe -m perf compare_to isfuture_original_2.json isfuture_optimized_2.json future

[issue33521] Add 1.32x faster C implementation of asyncio.isfuture().

2018-05-19 Thread Jimmy Lai
Jimmy Lai <yuri...@gmail.com> added the comment: @pitrou This change is part of optimization for asyncio.gather(). gather -> ensure_future -> isfuture/iscoroutine/isawaitable We need C implementation for all those function to make gather really efficient for large scale appl

[issue33521] Add 1.32x faster C implementation of asyncio.isfuture().

2018-05-19 Thread Jimmy Lai
Jimmy Lai <yuri...@gmail.com> added the comment: @pitrou We'll measure the wins of gather when we implement it in C. Before that, we need to get all helpers ready in C. -- ___ Python tracker <rep...@bugs.python.org> <https://

[issue33521] Optimize asyncio.isfuture by providing C implementation

2018-05-15 Thread Jimmy Lai
New submission from Jimmy Lai <yuri...@gmail.com>: asyncio.isfuture called whenever ensure_future is called. Providing C implementation to make it fast. -- components: asyncio messages: 316670 nosy: asvetlov, jimmylai, yselivanov priority: normal severity: normal status: open

[issue33521] Add 1.32x faster C implementation of asyncio.isfuture().

2018-05-15 Thread Jimmy Lai
Jimmy Lai <yuri...@gmail.com> added the comment: $./python.exe isfuture_benchmark.py -o isfuture_optimized.json $ ./python.exe -m perf compare_to isfuture_original.json isfuture_optimized.json Mean +- std dev: [isfuture_original] 7.16 ms +- 0.23 ms -> [isfuture_optimized] 5.41 ms +

[issue33521] Add 1.32x faster C implementation of asyncio.isfuture().

2018-05-25 Thread Jimmy Lai
Jimmy Lai <yuri...@gmail.com> added the comment: @vstinner In general, we would like to make all asyncio common functions efficient with C implementation because CPython asyncio overhead is very expensive. In our application, overall it costs about 10% global CPU instructions after we

[issue33521] Add 1.32x faster C implementation of asyncio.isfuture().

2018-05-15 Thread Jimmy Lai
Change by Jimmy Lai <yuri...@gmail.com>: -- keywords: +patch pull_requests: +6552 stage: -> patch review ___ Python tracker <rep...@bugs.python.org> <https://bugs.pyt

[issue33337] Provide a supported Concrete Syntax Tree implementation in the standard library

2020-03-13 Thread Jimmy Lai
Jimmy Lai added the comment: Just found Guido mentioned LibCST. Here is a quick overview: 1. LibCST is an open source Python concrete syntax tree parser. It provides a CST looks like and feel like AST. 2. It's built by Instagram for linter and refactoring tools (exact use cases what Ɓukasz