{"action":"created","issue":{"url":"https://api.github.com/repos/agronholm/pythonfutures/issues/39","repository_url":"https://api.github.com/repos/agronholm/pythonfutures","labels_url":"https://api.github.com/repos/agronholm/pythonfutures/issues/39/labels{/name}","comments_url":"https://api.github.com/repos/agronholm/pythonfutures/issues/39/comments","events_url":"https://api.github.com/repos/agronholm/pythonfutures/issues/39/events","html_url":"https://github.com/agronholm/pythonfutures/issues/39","id":94372389,"number":39,"title":"Map is still greedy","user":{"login":"mathieulongtin","id":617359,"avatar_url":"https://avatars.githubusercontent.com/u/617359?v=3","gravatar_id":"","url":"https://api.github.com/users/mathieulongtin","html_url":"https://github.com/mathieulongtin","followers_url":"https://api.github.com/users/mathieulongtin/followers","following_url":"https://api.github.com/users/mathieulongtin/following{/other_user}","gists_url":"https://api.github.com/users/mathieulongtin/gists{/gist_id}","starred_url":"https://api.github.com/users/mathieulongtin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mathieulongtin/subscriptions","organizations_url":"https://api.github.com/users/mathieulongtin/orgs","repos_url":"https://api.github.com/users/mathieulongtin/repos","events_url":"https://api.github.com/users/mathieulongtin/events{/privacy}","received_events_url":"https://api.github.com/users/mathieulongtin/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2015-07-10T19:14:08Z","updated_at":"2016-11-02T18:39:20Z","closed_at":"2015-07-20T16:44:02Z","body":"Further test of map suggests it is still greedy. If you submit a large iterator, it gets consumed almost immediately, causing memory issues.\n\nHere's a simple test. If map wasn't greedy, it would print \"time to first result\" almost immediately. But it prints when the processing is almost done.\n\n```\nimport concurrent.futures\nimport time\nimport sys\n\ndef job(i):\n    return i\n\nwith concurrent.futures.ThreadPoolExecutor(max_workers=4) as executor:\n    s = 0\n    start_time = time.time()\n    for i in executor.map(job, xrange(1, 100000)):\n        if s == 0:\n            print \"time to first result=%.3f s\" % (time.time() - start_time)\n        s += i\n    print \"time to finish=%.3f s\" % (time.time() - start_time)\n```\n"},"comment":{"url":"https://api.github.com/repos/agronholm/pythonfutures/issues/comments/257960010","html_url":"https://github.com/agronholm/pythonfutures/issues/39#issuecomment-257960010","issue_url":"https://api.github.com/repos/agronholm/pythonfutures/issues/39","id":257960010,"user":{"login":"Axik","id":3822675,"avatar_url":"https://avatars.githubusercontent.com/u/3822675?v=3","gravatar_id":"","url":"https://api.github.com/users/Axik","html_url":"https://github.com/Axik","followers_url":"https://api.github.com/users/Axik/followers","following_url":"https://api.github.com/users/Axik/following{/other_user}","gists_url":"https://api.github.com/users/Axik/gists{/gist_id}","starred_url":"https://api.github.com/users/Axik/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Axik/subscriptions","organizations_url":"https://api.github.com/users/Axik/orgs","repos_url":"https://api.github.com/users/Axik/repos","events_url":"https://api.github.com/users/Axik/events{/privacy}","received_events_url":"https://api.github.com/users/Axik/received_events","type":"User","site_admin":false},"created_at":"2016-11-02T18:39:20Z","updated_at":"2016-11-02T18:39:20Z","body":"What is a possible workaround for this?"}}
{"actor":{"display_login":"Axik"}}